Skip to content

Errors with an apparently valid schema #190

Closed
@DanBuchan

Description

@DanBuchan

Not sure if this is a bug, and I am new to the openapi ecosystem, but I am unable to solve this issue given the documentation provided. I have a very simple API implemented using Django-rest-framework and I have DRF auto-produce the openapi3 schema. I've validated with various tools that the schema is valid. However when I come to use openapi-python-client to generate a lib I get the following warning/errors (which I've abbreviated

Warning(s) encountered while generating. Client was generated, but some pieces may be missing
ERROR parsing PUT /api/gene/{id}/ within default. Endpoint will not be generated.
cannot parse body of endpoint UpdateGene
...
ERROR parsing POST /api/gene/{id}/ within default. Endpoint will not be generated.
cannot parse body of endpoint CreateGene
...
ERROR parsing GET /api/genes within default. Endpoint will not be generated.
cannot parse response of endpoint listGenes

I can not tell from the information provided if this problem is rooted in my use of DRF or openapi-python-client

I include the yaml doc in question below, though it doesn't immediately seem incorrect to me

openapi: 3.0.2
info:
  title: Genedata
  version: 1.0.0
  description: API for interacting with gene records
servers:
  - url: http://127.0.0.1:8080
paths:
  /api/gene/{id}/:
    get:
      operationId: RetrieveGene
      description: ''
      parameters:
      - name: id
        in: path
        required: true
        description: A unique integer value identifying this gene.
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  gene_id:
                    type: string
                    maxLength: 256
                  entity:
                    type: string
                    maxLength: 256
                  start:
                    type: integer
                    maximum: 2147483647
                    minimum: -2147483648
                  stop:
                    type: integer
                    maximum: 2147483647
                    minimum: -2147483648
                  sense:
                    type: string
                    maxLength: 1
                  start_codon:
                    type: string
                    maxLength: 1
                  ec:
                    properties:
                      id:
                        type: integer
                        readOnly: true
                      ec_name:
                        type: string
                        readOnly: true
                    type: object
                  sequencing:
                    properties:
                      id:
                        type: integer
                        readOnly: true
                      sequencing_factory:
                        type: string
                        readOnly: true
                      factory_location:
                        type: string
                        readOnly: true
                    type: object
                required:
                - gene_id
                - entity
                - sense
                - ec
                - sequencing
          description: ''
    post:
      operationId: CreateGene
      description: ''
      parameters:
      - name: id
        in: path
        required: true
        description: A unique integer value identifying this gene.
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema: &id001
              properties:
                gene_id:
                  type: string
                  maxLength: 256
                entity:
                  type: string
                  maxLength: 256
                start:
                  type: integer
                  maximum: 2147483647
                  minimum: -2147483648
                stop:
                  type: integer
                  maximum: 2147483647
                  minimum: -2147483648
                sense:
                  type: string
                  maxLength: 1
                start_codon:
                  type: string
                  maxLength: 1
                ec:
                  properties:
                    id:
                      type: integer
                      readOnly: true
                    ec_name:
                      type: string
                      readOnly: true
                  type: object
                sequencing:
                  properties:
                    id:
                      type: integer
                      readOnly: true
                    sequencing_factory:
                      type: string
                      readOnly: true
                    factory_location:
                      type: string
                      readOnly: true
                  type: object
              required:
              - gene_id
              - entity
              - sense
              - ec
              - sequencing
          application/x-www-form-urlencoded:
            schema: *id001
          multipart/form-data:
            schema: *id001
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  gene_id:
                    type: string
                    maxLength: 256
                  entity:
                    type: string
                    maxLength: 256
                  start:
                    type: integer
                    maximum: 2147483647
                    minimum: -2147483648
                  stop:
                    type: integer
                    maximum: 2147483647
                    minimum: -2147483648
                  sense:
                    type: string
                    maxLength: 1
                  start_codon:
                    type: string
                    maxLength: 1
                  ec:
                    properties:
                      id:
                        type: integer
                        readOnly: true
                      ec_name:
                        type: string
                        readOnly: true
                    type: object
                  sequencing:
                    properties:
                      id:
                        type: integer
                        readOnly: true
                      sequencing_factory:
                        type: string
                        readOnly: true
                      factory_location:
                        type: string
                        readOnly: true
                    type: object
                required:
                - gene_id
                - entity
                - sense
                - ec
                - sequencing
          description: ''
    put:
      operationId: UpdateGene
      description: ''
      parameters:
      - name: id
        in: path
        required: true
        description: A unique integer value identifying this gene.
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema: &id002
              properties:
                gene_id:
                  type: string
                  maxLength: 256
                entity:
                  type: string
                  maxLength: 256
                start:
                  type: integer
                  maximum: 2147483647
                  minimum: -2147483648
                stop:
                  type: integer
                  maximum: 2147483647
                  minimum: -2147483648
                sense:
                  type: string
                  maxLength: 1
                start_codon:
                  type: string
                  maxLength: 1
                ec:
                  properties:
                    id:
                      type: integer
                      readOnly: true
                    ec_name:
                      type: string
                      readOnly: true
                  type: object
                sequencing:
                  properties:
                    id:
                      type: integer
                      readOnly: true
                    sequencing_factory:
                      type: string
                      readOnly: true
                    factory_location:
                      type: string
                      readOnly: true
                  type: object
              required:
              - gene_id
              - entity
              - sense
              - ec
              - sequencing
          application/x-www-form-urlencoded:
            schema: *id002
          multipart/form-data:
            schema: *id002
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  gene_id:
                    type: string
                    maxLength: 256
                  entity:
                    type: string
                    maxLength: 256
                  start:
                    type: integer
                    maximum: 2147483647
                    minimum: -2147483648
                  stop:
                    type: integer
                    maximum: 2147483647
                    minimum: -2147483648
                  sense:
                    type: string
                    maxLength: 1
                  start_codon:
                    type: string
                    maxLength: 1
                  ec:
                    properties:
                      id:
                        type: integer
                        readOnly: true
                      ec_name:
                        type: string
                        readOnly: true
                    type: object
                  sequencing:
                    properties:
                      id:
                        type: integer
                        readOnly: true
                      sequencing_factory:
                        type: string
                        readOnly: true
                      factory_location:
                        type: string
                        readOnly: true
                    type: object
                required:
                - gene_id
                - entity
                - sense
                - ec
                - sequencing
          description: ''
    delete:
      operationId: DestroyGene
      description: ''
      parameters:
      - name: id
        in: path
        required: true
        description: A unique integer value identifying this gene.
        schema:
          type: string
      responses:
        '204':
          description: ''
  /api/genes:
    get:
      operationId: listGenes
      description: 'Get a list of genes'
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  properties:
                    id:
                      type: integer
                      readOnly: true
                    gene_id:
                      type: string
                      maxLength: 256
                  required:
                  - gene_id
          description: 'Sucesfully returns gene list'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions