Swagger: is it possible to make an operation parameter constant / readonly?

前端 未结 1 624
北荒
北荒 2020-12-17 15:29

This is the description of a certain parameter I have:

{
    \"name\": \"myParam\",
    \"description\": \"My param          


        
相关标签:
1条回答
  • 2020-12-17 16:08

    The proper way to declare this would be:

    {
        "name": "myParam",
        "description": "My param description",
        "required": true,
        "paramType": "query",
        "type": "string",
        "enum": [ "myValue" ]
    }
    

    The "enum" property sets the possible values. Once you set a single value to it, that's the only one that could be used and that would be available in the UI for the user to choose from.

    0 讨论(0)
提交回复
热议问题