autorest
autorest copied to clipboard
Array type on "default" property not accepted
Here is roughly my swagger file:
{
"swagger": "2.0",
...
"paths": {
"/{connectionId}/v1.0/connection": {
"post": {
...
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"required": [
"groupTypes"
],
"properties": {
"groupTypes": {
"type": "array",
"items": {
"type": "string",
"title": "",
"x-ms-summary": "Group Type"
},
"default": [
"Unified"
]
}
}
}
}
]
}
}
}
}
When I run autorest on this swagger file, it throws the following exception. The way to work around it is to remove the default value, but I think that a default array value should be accepted
Loading AutoRest core '/Users/mhoeger/.autorest/@[email protected]/node_modules/@autorest/core/dist' (3.0.6306)
Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.84)
Loading AutoRest extension '@microsoft.azure/autorest.typescript' (~4.2.0->4.2.4)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.51->2.3.51)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
FATAL: Error parsing swagger file. Unexpected character encountered while parsing value: [. Path 'components.schemas.schemas:4.default', line 1, position 29438.
FATAL: Error parsing swagger file. Unexpected character encountered while parsing value: [. Path 'components.schemas.schemas:4.default', line 1, position 29438.
FATAL: AutoRest.Core.Logging.CodeGenerationException: Error parsing swagger file. Unexpected character encountered while parsing value: [. Path 'components.schemas.schemas:4.default', line 1, position 29438.
at AutoRest.Modeler.SwaggerParser.Parse(String swaggerDocument) in c:\publish\autorest.modeler\src\SwaggerParser.cs:line 52
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in c:\publish\autorest.modeler\src\Program.cs:line 58
--- 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: AutoRest.Core.Logging.CodeGenerationException: Error parsing swagger file. Unexpected character encountered while parsing value: [. Path 'components.schemas.schemas:4.default', line 1, position 29438.
at AutoRest.Modeler.SwaggerParser.Parse(String swaggerDocument) in c:\publish\autorest.modele
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in c:\publish\autorest.modeler\src\Program.cs:line 58
--- 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()
Error: Plugin imodeler1 reported failure.
@timotheeguerin This is a pain point for several RPs , as fixing ARM round-trip issues needs to add default value which might be any type