-
Notifications
You must be signed in to change notification settings - Fork 738
Closed
Azure/ms-rest-js
#17Description
I'm trying to work out how to express a property that's an "any" type using swagger and autorest. What I found through searching the web is that in swagger 2.0 you need to simply remove the "type" for a property to say its an any which if you look at my value property you'll see I've done:
"CardAction": {
"description": "A clickable action",
"type": "object",
"properties": {
"type": {
"$ref": "#/definitions/ActionTypes",
"description": "The type of action implemented by this button"
},
"title": {
"description": "Text description which appears on the button",
"type": "string"
},
"image": {
"description": "Image URL which will appear on the button, next to text label",
"type": "string"
},
"text": {
"description": "Text for this action",
"type": "string"
},
"displayText": {
"description": "(Optional) text to display in the chat feed if the button is clicked",
"type": "string"
},
"value": {
"description": "Supplementary parameter for action. Content of this property depends on the ActionType"
}
}
}But when I run this through autorest using the --typescript switch get a mapping to type object in the generated mapper.ts file which causes the generated client to fail the outbound serialization for non-object values:
export const CardAction = {
required: false,
serializedName: 'CardAction',
type: {
name: 'Composite',
className: 'CardAction',
modelProperties: {
type: {
required: false,
serializedName: 'type',
type: {
name: 'String'
}
},
title: {
required: false,
serializedName: 'title',
type: {
name: 'String'
}
},
image: {
required: false,
serializedName: 'image',
type: {
name: 'String'
}
},
text: {
required: false,
serializedName: 'text',
type: {
name: 'String'
}
},
displayText: {
required: false,
serializedName: 'displayText',
type: {
name: 'String'
}
},
value: {
required: false,
serializedName: 'value',
type: {
name: 'Object'
}
}
}
}
};Is this just a bug in the typescript plugin?
Metadata
Metadata
Assignees
Labels
No labels