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

Conversion fails – because of nullable attributes? #76

Open
R3gi opened this issue Feb 6, 2024 · 0 comments
Open

Conversion fails – because of nullable attributes? #76

R3gi opened this issue Feb 6, 2024 · 0 comments

Comments

@R3gi
Copy link

R3gi commented Feb 6, 2024

When I try to convert the API Blueprint docs to Open API v3.0, the script fails.
cat apiary.apib | npx apib2swagger --yaml --open-api-3 > swagger.yaml

TypeError: Cannot read properties of undefined (reading 'value')
    at setResponseSchema (/Users/userme/.npm/_npx/b8304055354efd5a/node_modules/apib2swagger/src/responses.js:92:28)
    at module.exports.processResponses (/Users/userme/.npm/_npx/b8304055354efd5a/node_modules/apib2swagger/src/responses.js:181:29)
    at swaggerOperation (/Users/userme/.npm/_npx/b8304055354efd5a/node_modules/apib2swagger/index.js:160:22)
    at swaggerPaths (/Users/userme/.npm/_npx/b8304055354efd5a/node_modules/apib2swagger/index.js:148:60)
    at /Users/userme/.npm/_npx/b8304055354efd5a/node_modules/apib2swagger/index.js:71:17
    at Array.forEach (<anonymous>)
    at /Users/userme/.npm/_npx/b8304055354efd5a/node_modules/apib2swagger/index.js:62:26
    at Array.forEach (<anonymous>)
    at module.exports.convertParsed (/Users/userme/.npm/_npx/b8304055354efd5a/node_modules/apib2swagger/index.js:57:8)
    at exports.convert (/Users/userme/.npm/_npx/b8304055354efd5a/node_modules/apib2swagger/index.js:200:23)

When I run the script without the --open-api-3 flag, the file is converted, but IDE indicates "Property 'oneOf' is not allowed" errors and the official SwaggerEditor detects problems for all the nullable - 'null' properties. I guess the problem could be caused by the nullable values which are not handled properly.

Generated Open API v2.0:

      homeAddress:
        oneOf:
          - $ref: '#/definitions/Address'
            description: homeAddress, response only
          - type: 'null'

The source document has more than 1300 lines and is private so I cannot post it. It is valid according the API blueprint specs.

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