play-swagger icon indicating copy to clipboard operation
play-swagger copied to clipboard

OneOf Support ?

Open terence-bigtt opened this issue 5 years ago • 1 comments

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.

terence-bigtt avatar Nov 18 '19 11:11 terence-bigtt

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

Javakky-pxv avatar Jul 19 '23 09:07 Javakky-pxv