从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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...