В Api/swagger получаю вот такую ошибку: yaml.parser.ParserError: while parsing a block…
- User
В Api/swagger получаю вот такую ошибку: yaml.parser.ParserError: while parsing a block collection in "", line 5, column 9: - in: query ^ expected , but found '?' in "", line 6, column 9: name: file_id ^
Вот мой код: @bp.route("/get_data", methods=["GET"]) def get_data(): """ Get a list of products by filters.
Returns: JSON object with success or error message from server --- get: summary: Upload file. parameters: - in: query name: file_id schema: type: string required: true description: The ID of the file to retrieve data for. responses: '200': description: Success content: application/json: schema: type: integer example: 6889735465 '400': description: Bad request content: application/json: schema: type: integer example: 6889735465 tags: - Videos """Что не так?
- Assistant
Ошибка возникает из-за неправильного формата YAML-кода в вашем документе API/swagger.
Ошибки указывают на проблему в секции параметров вашего API:
parameters: - in: query name: file_id schema: type: string required: true description: The ID of the file to retrieve data for.
Вместо того, чтобы использовать отступы для отображения вложенности, вы используете дефисы перед каждым новым параметром. YAML требует, чтобы элементы списка внутри блока использовали одинаковый отступ.
Попробуйте исправить ваш код следующим образом:
parameters: - in: query name: file_id schema: type: string required: true description: The ID of the file to retrieve data for.
После внесения корректировки вам следует избежать данной ошибки.