Autorest python failing for x-ms-pageable extension while passing for CSharp
See original GitHub issueInput Json: https://github.com/Azure/azure-rest-api-specs/blob/master/arm-recoveryservicesbackup/2016-12-01/swagger/backupManagement.json Autorest version: 1.0.1-20170517-2300-nightly
Failure error:
FATAL: System.Collections.Generic.KeyNotFoundException: Couldn't find the item property specified by extension
at AutoRest.Python.Azure.TransformerPya.GetPagingSetting(CodeModelPya codeModel, CompositeType body, Dictionary`2 extensions, String valueTypeName, IDictionary`2 typePageClasses, String methodName)
at AutoRest.Python.Azure.TransformerPya.NormalizePaginatedMethods(CodeModelPya codeModel)
at AutoRest.Python.Azure.TransformerPya.TransformCodeModel(CodeModel cm)
at Generator.<ProcessInternal>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NewPlugin.<Process>d__11.MoveNext()
FATAL: python/generate - FAILED
Process() Cancelled due to exception : Plugin python reported failure.
Error: Plugin python reported failure.
at C:\Users\dhratho\.autorest\plugins\autorest\1.0.1-20170517-2300-nightly\node_modules\autorest-core\lib\pipeline\pipeline.js:88:19
at next (native)
at fulfilled (C:\Users\dhratho\AppData\Roaming\npm\node_modules\autorest\lib\polyfill.min.js:10:59)
at process._tickCallback (internal/process/next_tick.js:109:7)
This error is coming for Python generator while working fine for CSharp generator.
Diagnostics:
- In paths with operation_id Operations_List, response schema name is ClientDiscoveryResponse which is pageable and hence NextLink and Value fields are present in schema.
- In schema properties NextLink and Value are present, but python generator is looking for “value” field which is not present and hence failing. (Autorest.Python.Azure TransformerPya.cs#129).
- But on the other hand in CSharp generator (Autorest.CSharp.Azure TransformerCsa.cs#184 GetPagingSetting) no such check is present.
- On further analysis it turns out that this check is present only in Python generator, which presents inconsistency across generator transformers.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
AutoRest Extensions for OpenAPI 2.0 - Azure documentation
Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python. ... Microsoft Azure Extensions (available in most generators only when using --azure-arm ).
Read more >@autorest/azure-functions-python - npm
The Azure Functions extension for code generators in AutoRest.. Latest version: 0.1.0-preview, last published: 2 years ago.
Read more >rest - How to downgrade Autorest extensions - specifically C# ...
I am using Autorest to generate C# code from an OpenAPI YAML file. I tried to upgrade the Autorest C# extension to the...
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
excellent idea, I’ll file an issue!
@olydis C# generator doesn’t check whether property with itemName actually exists. Surprising thing is only Python generator is making this check and even Python generator is missing check for nextLinkName (though code exists, it is just not enforcing check).
I believe python is making these checks as in-built
json
module in python is case sensitive.Although this can be made consistent across languages by adding these checks appropriately.