Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OneOf Support ? #295

Open
terence-bigtt opened this issue Nov 18, 2019 · 1 comment
Open

OneOf Support ? #295

terence-bigtt opened this issue Nov 18, 2019 · 1 comment

Comments

@terence-bigtt
Copy link

terence-bigtt commented Nov 18, 2019

Hi !

I am trying to generate an openapi spec with a oneOf field.

I've put the schema containing the oneOf in the conf/swagger.json file:


  "components": {
    "schemas": {
      "models.RequestType": {
          "oneOf": [
            {"$ref" : "#/components/schemas/models.OccurenceData"},
            {"$ref": "#/components/schemas/models.EntityOccurenceData"},
            {"$ref": "#/components/schemas/models.CategoricalData"},
            {"$ref": "#/components/schemas/models.EntityCategoricalData"},
            {"$ref": "#/components/schemas/models.ValueData"},
            {"$ref": "#/components/schemas/models.EntityValueData"}
          ]
      },
      "models.DatasetSpecs": {
        "properties": {
          "populationId":{"type":  "string"},
          "dataSpec": {
            "type": "array",
            "items": {
              "$ref":"#/components/schemas/models.DataSpec"
            }
          },
          "period":{
            "type": "array",
            "items": {
              "$ref":"#/components/schemas/models.Period"
            }
          }
        }
      }
    }
  }

All the refered models are generated correctly. The DataSpec model is generated correctly.
However, the route parameters will not refer to it:

###
#  parameters:
#    - name: body
#      schema:
#        $ref: '#/components/schemas/models.DatasetSpecs'
POST        /dataset                 controllers.DatasetController.create

does render an empty post route.

Expected behavior:

The openapi file should contain a response type and a body parameter pointing to the documented ref.

@Javakky-pxv
Copy link
Collaborator

@terence-bigtt
最終的に生成された YAML はどのようになっていますか?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants