如何解决从Symfony Api Entiy导出并在Swagger中导入
我使用Symfony api在我使用此命令的json文件中导出实体
bin /控制台api:openapi:export --output = swagger_docs.json
我得到的代码有错误:
路径上的语义错误./api/books.get.responses.200.content.application/ld+json.schema.properties.hydra:member.items.$ref $ ref值必须是RFC3986兼容的百分比编码URI **
components.schemas.Book:jsonld的语义错误 组件名称只能包含字符A-Z a-z 0-9-。 _
我的代码:
openapi: 3.0.2
info:
title: ''
version: 0.0.0
paths:
/api/books:
get:
tags:
- Book
operationId: getBookCollection
summary: Retrieves the collection of Book resources.
responses:
'200':
description: Book collection response
content:
application/ld+json:
schema:
type: object
properties:
'hydra:member':
type: array
items:
$ref: '#/components/schemas/Book:jsonld' //Semantic error at paths./api/books.get.responses.200.content.application/ld+json.schema.properties.hydra:member.items.$ref
$ref values must be RFC3986-compliant percent-encoded URIs**
'hydra:totalItems':
type: integer
minimum: 0
'hydra:view':
type: object
properties:
'@id':
type: string
format: iri-reference
'@type':
type: string
'hydra:first':
type: string
format: iri-reference
'hydra:last':
type: string
format: iri-reference
'hydra:next':
type: string
format: iri-reference
'hydra:search':
type: object
properties:
'@type':
type: string
'hydra:template':
type: string
'hydra:variableRepresentation':
type: string
'hydra:mapping':
type: array
items:
type: object
properties:
'@type':
type: string
variable:
type: string
property:
type: string
required:
type: boolean
required:
- 'hydra:member'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Book'
text/html:
schema:
type: array
items:
$ref: '#/components/schemas/Book'
parameters:
- name: page
in: query
required: false
description: The collection page number
schema:
type: integer
default: 1
components:
schemas:
Book:
type: object
description: ''
properties:
id:
readOnly: true
type: integer
name:
type: string
nullable: true
'Book:jsonld': // Semantic error at components.schemas.Book:jsonld
Component names can only contain the characters A-Z a-z 0-9 - . _
type: object
description: ''
properties:
'@context':
readOnly: true
type: string
'@id':
readOnly: true
type: string
'@type':
readOnly: true
type: string
id:
readOnly: true
type: integer
name:
type: string
nullable: true
我不知道如何解决我尝试在文档中找到的错误,但是我什么也没找到
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。