OpenAPI V3 - Cannot parse OpenAPI v3 definition file with schema containing 'additionalProperties' with boolean value
See original GitHub issueHello,
I started to use the latest version of autorest (3.0.6187) which supports OpenApi v3. I have definition file generated from swagger using SwashBuckle library (using .net core application).
I am generating client with autorest using parameter --v3
. However autorest returns following error
FATAL: AutoRest.Core.Logging.CodeGenerationException: Error parsing swagger file. Error converting value False to type 'AutoRest.Modeler.Model.Schema'. Path 'components.schemas.BrandDto.additionalProperties', line 1, position 1439.
It seems that autorest does not support boolean values for additionalProperties
as it is supported by OpenApi v3. Anyway if I change the additionalProperties : false
to additionalProperties : {}
it starts to work.
Here is the sample json used:
{
"openapi": "3.0.1",
"info": {
"title": "Product Global Taxonomy Service API",
"version": "v1"
},
"paths": {
"/taxonomy/brands": {
"get": {
"summary": "Provides taxonomy brands",
"operationId": "GetTaxonomyBrandsDeprecated",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BrandCollection"
}
}
}
}
},
"deprecated": true
}
}
},
"components": {
"schemas": {
"BrandDto": {
"type": "object",
"properties": {
"taxonomyBrandId": {
"type": "integer",
"description": "Surrogate Brand Id",
"format": "int32"
},
"name": {
"type": "string",
"description": "Brand name",
"nullable": true
}
},
"additionalProperties": false
},
"BrandCollection": {
"type": "object",
"properties": {
"collection": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BrandDto"
},
"nullable": true
}
},
"additionalProperties": false
}
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:11 (4 by maintainers)
Top GitHub Comments
Hi, using
--use:@autorest/csharp-v3@3.0.0-dev.20200512.1
or--use:@autorest/csharp-v3@https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200512.9/autorest-csharp-v3-3.0.0-dev.20200512.9.tgz
(as mentioned here) did not help.However using parameter
--version=3.0.6274
helped! Thanks to bernardenThe only thing that should matter here is the core version (
--version=next
). Closing as this seems to have been resolved. Will publish to latest in the next few days.