Autorest SDK generation failure for Security Swagger Spec
See original GitHub issueThe following autorest SDK generation command fails:
autorest --package-name=azure_mgmt_security --input-file=https://raw.githubusercontent.com/Azure/azure-rest-api-specs/555cfa70276c824ca18c1e41072e7c0562cbadc3/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/security.json --namespace=Azure::Security::Mgmt::V2015_06_01_preview --title=SecurityManagementClient --package-version=0.16.0 --output-folder=/Users/saranganrajamanickam/Projects/azure-sdk-for-ruby/management/azure_mgmt_security/lib/ --ruby --azure-arm
..........
..........
FATAL: System.InvalidOperationException: Found incompatible property types , for property 'properties' in schema inheritance chain
at AutoRest.Modeler.SchemaResolver.ExpandAllOf(Schema schema) in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\20_20171009T223650\autorest.modeler\src\SchemaResolver.cs:line 157
at AutoRest.Modeler.SchemaResolver.Unwrap(Schema schema) in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\20_20171009T223650\autorest.modeler\src\SchemaResolver.cs:line 75
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName) in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\20_20171009T223650\autorest.modeler\src\SchemaBuilder.cs:line 35
at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\20_20171009T223650\autorest.modeler\src\SwaggerModeler.cs:line 300
at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\20_20171009T223650\autorest.modeler\src\SwaggerModeler.cs:line 69
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\20_20171009T223650\autorest.modeler\src\Program.cs:line 53
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NewPlugin.<Process>d__15.MoveNext()
FATAL: ruby/modeler - FAILED
FATAL: Error: Plugin modeler reported failure.
Process() cancelled due to exception : Plugin modeler reported failure.
Note This happens for the generation of ALL SDKs and not specific to Ruby SDK. The error happens here in the following condition:
.......
.......
if (!SchemaTypesAreEquivalent(parentProperty, unwrappedProperty))
{
throw new InvalidOperationException(
string.Format(CultureInfo.InvariantCulture,
Properties.Resources.IncompatibleTypesInBaseSchema, propertyName,
parentProperty.Type,
unwrappedProperty.Type, schema.Title));
}
.......
.......
In the above condition, the code compares the models ExternalSecuritySolution
and CefSolutionProperties
. I have checked (both manually and through oav tool). These models are not similar or related. So, I am not sure about the root cause of this error.
Note that if the above condition is removed, I am able to generate the SDK successfully. But, I am not sure why this condition was added in the first place and the reason behind it. So, I am raising this issue with the autorest team.
Also, please note that this specific security service has been requested by our customer - Chef. So, it would be greatly appreciated if this issue is resolved in a timely manner. Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Well, it 's trying to determine if two schemas are the same or not, because when it’s merging definitions, it’s not a hyper-smart recursive merge algorithm.
It’s finding that
ExternalSecuritySolution
has a property calledproperties
.CefExternalSecuritySolution
does anallOf
with theExternalSecuritySolution
model.CefExternalSecuritySolution
is also declaring a property calledproperties
which is of typeCefSolutionProperties
The AutoRest modeler uses inheritance to represent
allOf
, and this swagger is trying to have a child with a redefinition of theproperties
property.There is no way to merge the two child definitions …ESPECIALLY with a polymorphic discriminator in the way.
abstractly, it’s trying to do this:
Take the
properties
property definition out of the base class, and have a separate model that all the child classproperties
model types can do anallOf
with.G
@sarangan12 @fearthecowboy ping 😃