Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to generate valid OpenAPI from API Blueprint #372

Open
doobnet opened this issue Oct 12, 2023 · 0 comments
Open

Fails to generate valid OpenAPI from API Blueprint #372

doobnet opened this issue Oct 12, 2023 · 0 comments

Comments

@doobnet
Copy link

doobnet commented Oct 12, 2023

I'm trying to convert an API Blueprint document to OpenAPI. No errors are generated but the resulting OpenAPI document doesn't seem to be valid.

Here's a minmal test case of an API Blueprint document that fails:

FORMAT: 1A
HOST: http://127.0.0.1/api/v1

# Group Extensions

## Extensions [/extensions]

### Get extensions [GET]

+ Response 200 (application/json)
    + Attributes (Extension)

## Data Structures

### Extension (enum)

+ (Foo type)

### Foo type (object, fixed-type)

+ id (string) - the id

The resulting OpenAPI document is:

openapi: 3.0.0
info:
  description: ''
  title: ''
  version: ''
servers:
  - url: 'http://127.0.0.1/api/v1'
paths:
  /extensions:
    get:
      responses:
        '200':
          content:
            application/json:
              examples:
                response:
                  value:
                    id: ''
              schema:
                enum:
                  - id: ''
                type: extend
          description: OK
          headers: {}
      tags:
        - Extensions
      description: ''
      summary: Get extensions
components:
  schemas:
    Extension:
      enum: []
      type: Foo type
    Extensions: {}
    Foo_type:
      properties:
        id:
          description: the id
          type: string
      type: object
tags:
  - name: Extensions

I used the following command to run api-spec-converter:

api-spec-converter -f api_blueprint -t openapi_3 -s yaml example.md > openapi.yaml

Validating the OpenAPI document using an online validating tool [1] gives the following errors:

Swagger schema validation failed.
  #/paths/~1extensions/get/responses/200/content/application~1json/schema/type must be equal to one of the allowed values
  #/paths/~1extensions/get/responses/200/content/application~1json/schema must have required property '$ref'
  #/paths/~1extensions/get/responses/200/content/application~1json/schema must match exactly one schema in oneOf
  #/paths/~1extensions/get/responses/200 must have required property '$ref'
  #/paths/~1extensions/get/responses/200 must match exactly one schema in oneOf
  #/components/schemas/Extension/enum must NOT have fewer than 1 items
  #/components/schemas/Extension/type must be equal to one of the allowed values
  #/components/schemas/Extension must have required property '$ref'
  #/components/schemas/Extension must match exactly one schema in oneOf


o@https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:95569
@https://apitools.dev/swagger-parser/online/js/bundle.min.js:29:45045

o@https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:95569
validateSchema@https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:6328
@https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:3405

[1] https://apitools.dev/swagger-parser/online/

@doobnet doobnet changed the title Fails to generate valid OpenAPI from Blueprint Fails to generate valid OpenAPI from API Blueprint Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant