expose properties in OpenAPI based on configuration (#289)

This commit is contained in:
Tom Kralidis
2019-10-31 14:13:04 -04:00
committed by GitHub
parent a4d217ada6
commit 61b1617d56
+29 -28
View File
@@ -322,36 +322,37 @@ def get_oas_30(cfg):
{'$ref': '{}#/components/parameters/datetime'.format(OPENAPI_YAML['oapif'])}) # noqa
for k2, v2 in p.fields.items():
path_ = '{}/items'.format(collection_name_path)
if p.properties and k2 in p.properties:
path_ = '{}/items'.format(collection_name_path)
if v2['type'] == 'date':
schema = {
'type': 'string',
'format': 'date'
}
elif v2['type'] == 'float':
schema = {
'type': 'number',
'format': 'float'
}
elif v2['type'] == 'long':
schema = {
'type': 'integer',
'format': 'int64'
}
else:
schema = {
'type': v2['type']
}
if v2['type'] == 'date':
schema = {
'type': 'string',
'format': 'date'
}
elif v2['type'] == 'float':
schema = {
'type': 'number',
'format': 'float'
}
elif v2['type'] == 'long':
schema = {
'type': 'integer',
'format': 'int64'
}
else:
schema = {
'type': v2['type']
}
paths['{}'.format(path_)]['get']['parameters'].append({
'name': k2,
'in': 'query',
'required': False,
'schema': schema,
'style': 'form',
'explode': False
})
paths['{}'.format(path_)]['get']['parameters'].append({
'name': k2,
'in': 'query',
'required': False,
'schema': schema,
'style': 'form',
'explode': False
})
paths['{}/items/{{featureId}}'.format(collection_name_path)] = {
'get': {