Вложенная колба api swagger не работает - PullRequest
0 голосов
/ 11 декабря 2018
address = api.schema_model('Address', {
    'properties': {
        'road': {
            'type': 'string'
        },
    },
    'type': 'object' })

person = address = api.schema_model('Person', {
    'required': ['address'],
    'properties': {
        'name': {
            'type': 'string'
        },
        'age': {
            'type': 'integer'
        },
        'birthdate': {
            'type': 'string',
            'format': 'date-time'
        },
        'address': {
            '$ref': '#/definitions/Address',
        }
    },
    'type': 'object' })

Ошибки Скрыть ошибку решателя при определении .Person.properties.address. $ Ref Не удалось разрешить ссылку из-за: Не удалось разрешить указатель: / NestedModel не существует в документе

1 Ответ

0 голосов
/ 13 декабря 2018

Наконец-то я могу решить проблему с кодом ниже

nested_fields = api.schema_model('NestedModel', {'name': fields.String})
person = address = api.schema_model('Person', {
    'required': ['address'],
    'properties': {
        'name': {
            'type': 'string'
        },
        'age': {
            'type': 'integer'
        },
        'birthdate': {
            'type': 'string',
            'format': 'date-time'
        },
        'address': {

            'properties': {
                'arguments': {
                    'type': 'array',
                    'items': {

                    }
                }
            },
            'type': 'object'
        }
    },
    'type': 'object'
})
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...