acacode / swagger-typescript-api

Generate the API Client for Fetch or Axios from an OpenAPI Specification
MIT License
3.27k stars 354 forks source link

parseSchema in schema-parser.js doesn't support boolean schemas #769

Open paztis opened 3 months ago

paztis commented 3 months ago

Boolean are valid schemas false is the equivalent of never and true the equivalent of anything:

components: schemas: AnyType: true

But when I use this, I have an exception in parseSchema method

TypeError: Cannot use 'in' operator to search for 'content' in true
    at SchemaParser.parseSchema (./node_modules/swagger-typescript-api/src/schema-parser/schema-parser.js:218:19)
    at SchemaParserFabric.parseSchema (./node_modules/swagger-typescript-api/src/schema-parser/schema-parser-fabric.js:102:25)
    at ./node_modules/swagger-typescript-api/src/code-gen-process.js:127:46