Open bernarden opened 4 years ago
Looks like the same issue as #3497 and #3439 due to additionalProperties: false
?
Yeah. There are additionalProperties: false
in my swagger definition but as I mentioned above this became an issue only after @autorest/core 3.0.6282 was released. I fixed my immediate issue by adding --version=3.0.6274
to the list of autorest arguments.
tried the switch.. did not work for me I should probably fire separate issue
AutoRest code generation utility [cli version: 3.0.6187; node: v14.2.0, max-memory: 8192 gb]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core 'C:\Users\vhaken.autorest\@autorest_core@3.0.6274\node_modules\@autorest\core\dist' (3.0.6274)
Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.84)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
FATAL: The schema's 'Customs.Catalog.Domain.Models.DTO.RetailerPrice-currency' ancestors should have at lease one property
FATAL: AutoRest.Core.Logging.CodeGenerationException: The schema's 'Customs.Catalog.Domain.Models.DTO.RetailerPrice-currency' ancestors should have at lease one property
at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 361
at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 66
at AutoRest.Modeler.Program.
the underlying spec piece (type with property tied to enum)
"Customs.Catalog.Domain.Models.Enums.CurrencyIso": {
"enum": [
1,
85
],
"type": "integer",
"description": "Currency Iso Values",
"format": "int32"
},
"Customs.Catalog.Domain.Models.DTO.RetailerPrice": {
"type": "object",
"properties": {
"amount": {
"type": "number",
"description": "Amount",
"format": "double",
"nullable": true
},
"currency": {
"allOf": [
{
"$ref": "#/components/schemas/Customs.Catalog.Domain.Models.Enums.CurrencyIso"
}
],
"description": "Currency",
"nullable": true
}
},
"additionalProperties": false,
"description": "Price"
}
tried the switch.. did not work for me I should probably fire separate issue
From the error message, I think your issue is due to
"currency": {
"allOf": [
{
"$ref": "#/components/schemas/Customs.Catalog.Domain.Models.Enums.CurrencyIso"
}
],
"description": "Currency",
"nullable": true
}
Which is not currently supported by Autorest. See Azure/autorest#2652 and Azure/autorest#3417 for workarounds.
same here:
And i think it has nothing to do with the allOf, because I dont have it in my swagger file.
Also experiencing this issue with 3.0.6282.
3.0.6274 is working just fine.
I am using swagger spec 3.0.1 to generate a python client using autorest. I see varied behavior with different versions. Observation:
1. from 6267 - 6277 - FATAL: System.NullReferenceException: Object reference not set to an instance of an object. is coming
2. from 6280 - 6300 - FATAL: Error parsing swagger file. Error converting value False to type 'AutoRest.Modeler.Model.Schema'. Path 'components.schemas.SomeObject.additionalProperties', line 1, position 88165. is coming
3. from 6302 and above it is creating client but without base_url which we need for implementation.
Can you help us figure out either:
azure.core
To add to this my additionalProperties thing got resolved with 3.0.6274 in csharp but fails like above in python.
See also #3524.
Since Autorest Core 3.0.6282 was released today, my build is failing to generate c# clients. It was working fine with AutoRest 3.0.6187 and Autorest Core 3.0.6274 just a day ago.
The error I'm receiving is: