Autorest fails if ancestor has no properties (and it shouldn't)
See original GitHub issueLet’s say something like this:
"Article": {
"allOf": [
{
"$ref": "#/definitions/CreativeWork"
}
],
"type": "object"
},
"NewsArticle": {
"description": "Defines a news article.",
"allOf": [
{
"$ref": "#/definitions/Article"
}
],
"type": "object",
"properties": {}
},
Autorest fails:
AutoRest code generation utility [version: 2.0.4166]
(C) 2017 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest extension '@microsoft.azure/autorest.python' (preview)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.1.22)
FATAL: The schema's 'NewsArticle' ancestors should have at lease one property
FATAL: AutoRest.Core.Logging.CodeGenerationException: The schema's 'NewsArticle' ancestors should have at lease one property
at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\20_20171009T223650\autorest.modeler\src\SwaggerModeler.cs:line 312
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>d2.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>d15.MoveNext()
Discussed with @amarzavery and looked at the Swagger spec, there is nothing that prevents an ancestor to do not have properties (whether it’s a good Swagger or not is not the question here, this respects the spec).
Impact WebSearch.
FYI @stefanvalianu
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Autorest fails if ancestor has no properties (and it shouldn't)
Autorest fails if ancestor has no properties (and it shouldn't )
Read more >c# - Autorest Failed resolving swagger.json against file when ...
I only just discovered that I can generate from local host if I cut and paste swagger.json to a file. I would prefer...
Read more >Troubleshoot images in an Azure Compute Gallery
Learn how to troubleshoot problems with shared images in Azure Compute Galleries. ... Changing any of these properties is not permitted ...
Read more >Sqoop User Guide (v1.4.6) - The Apache Software Foundation!
Sqoop is a tool designed to transfer data between Hadoop and relational databases or mainframes. You can use Sqoop to import data from...
Read more >Developing Integrated Spreadsheets Using Oracle Visual ...
Oracle Corporation and its affiliates are not responsible for and expressly ... "ancestor" columns with the correct values when you provide valid values...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yup that’s on my radar and if I’m not mistaken I even have a branch sitting somewhere that has a fix - the spec will be the perfect testcase 😉
So the AutoRest with VisualStudio AddRestApi still doesn’t work. So the workaround until microsoft uses --generate-empty-classes would be to simply add a unused property inside that class. public int? Fake { get; set; } then create the client and then remove it from your project. The reason that we could not use AutoRest cli is that on one of the development machines the installation is corrupted. So we did this and the GUI works.