kminami / apib2swagger

Convert API Blueprint to Swagger 2.0 or OpenAPI 3.0.
MIT License
203 stars 36 forks source link

Fails to generate OpenAPI from API Blueprint #73

Closed doobnet closed 1 year ago

doobnet commented 1 year ago

I'm trying to convert an API Blueprint document to OpenAPI but it fails with the following error: Type "extend" is not a valid type.

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

I used the following command to run the tool:

apib2swagger -i example.md --open-api-3 -o openapi.json

The full output of running the above command is:

Error
    at Object.<anonymous> (apib2swagger/node_modules/json-schema-to-openapi-schema/index.js:8:30)
    at Module._compile (node:internal/modules/cjs/loader:1255:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1137:19)
    at require (node:internal/modules/helpers:121:18)
    at Object.<anonymous> (apib2swagger/src/requests.js:4:19)
    at Module._compile (node:internal/modules/cjs/loader:1255:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10) {
  name: 'InvalidTypeError',
  message: 'Type "extend" is not a valid type'
}
kminami commented 1 year ago

Thank you for reporting! I have fixed bugs around enum of MSON at v1.17.1. Please confirm the result.

doobnet commented 1 year ago

Yes, it's working. Thanks.