Hi all,
I am trying to setup a query parameter for an array of string with values
defined in an enum. Pretty much like in the example shown here (taken from
https://swagger.io/docs/specification/2-0/describing-parameters/) except
that I am using a reference...
swagger: "2.0"
paths:
/search:
get:
operationId: services.search.pages.search
tags:
- Search
summary: Search within all pages
description: Search within all pages
parameters:
- $ref: "#/parameters/color"
parameters:
color:
name: color
required: false
type: array
uniqueItems: true
items:
type: string
enum: [black, white, gray, red, pink, orange]
When I start my application, I am getting this error message (Sorry for the
poorly formatted message but that's how it shows up in my terminal):
swagger_spec_validator.common.SwaggerValidationError: ("{'uniqueItems':
True, 'items': {'enum': ['black', 'white', 'gray', 'red', 'pink', 'orange',
'yellow', 'green', 'blue', 'purple', 'brown'], 'type': 'string'},
'required': False, 'type': 'array', 'name': 'color'} is not valid under any
of the given schemas\n\nFailed validating 'oneOf' in
schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['parameters']['items']:\n
{'oneOf': [{'$ref': '#/definitions/parameter'},\n {'$ref':
'#/definitions/jsonReference'}]}\n\nOn
instance['paths']['/search']['get']['parameters'][0]:\n {'$ref':
'#/parameters/color', u'x-scope': [u'']}", <ValidationError:
"{'uniqueItems': True, 'items': {'enum': ['black', 'white', 'gray', 'red',
'pink', 'orange', 'yellow', 'green', 'blue', 'purple', 'brown'], 'type':
'string'}, 'required': False, 'type': 'array', 'name': 'color'} is not
valid under any of the given schemas">)
I am using Python 2.7 with Flask and the Connexion module. If you confirm
that my syntax is correct then I will check with them. It might be a bug on
their side.
Thanks
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.