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

Inflector determines that a swagger spec with enum: *enum_values is an error

Open jeff9finger opened this issue 10 years ago • 2 comments

But if I use this construct in swagger-ui, it is valid.

Here is a sample spec:

definitions:
  Enum:
    properties: {}
    type: string
    enum: &enum_values
    - A
    - B
    - C
parameters:
  enum_vals:
    name: enum_vals
    in: query
    required: false
    type: string
    enum: *enum_values
    default: A

swagger-inflector says that this is invalid.

So, is this legal?

And is there a way to specify a parameter using a schema with an enum type?

Like this:

definitions:
  Enum:
    properties: {}
    type: string
    enum: &enum_values
    - A
    - B
    - C
parameters:
  enum_vals:
    name: enum_vals
    in: query
    required: false
    schema:
      $ref: '#/definitions/Enum'
    default: A

jeff9finger avatar Feb 24 '16 00:02 jeff9finger

The swagger-core issue is swagger-api/swagger-core#1601

Once both of those issues are resolved, the swagger-core version and the joda version (maybe) need to be upgraded.

        <swagger-core-version>1.5.8-SNAPSHOT</swagger-core-version>
        <joda-time-version>2.9.2</joda-time-version>
        <joda-version>1.8.1</joda-version>

jeff9finger avatar Mar 01 '16 20:03 jeff9finger