Request parameters are always sorted by requiredness and alphabetically
Lexy2 opened this issue · comments
No matter how I order request parameters for my endpoints, whether I use x-position
to reorder parameters or not, the request parameters are always sorted by required, then alphabetically.
Context
We use standard parameter names in our request queries - StartDate
, EndDate
, LastUpdatedDate
. The first two are required, the last one is optional. The parameters are always sorted alphabetically, regardless of their appearance in the schema.
I've fixed the order of endpoints and groups by sorting them correctly, but parameter order is not preserved in any way in stoplight.
Current Behavior
Expected Behavior
Possible Workaround/Solution
Rename parameters in the schema so that they are sorted the right way, i.e. add a space before a parameter.
It will be shown in the right order, but the Try It functionality will be cooked.
Steps to Reproduce
- Run Stoplight Elements on top of any schema that has parameters.
- Play with parameter ordering in the schema.
- Try adding
x-position
to the parameters.
The extract from the schema:
"parameters": [
{
"type": "string",
"name": "StartDate",
"in": "query",
"required": true,
"format": "date-time",
"x-nullable": false,
},
{
"type": "string",
"name": "EndDate",
"in": "query",
"required": true,
"format": "date-time",
"x-nullable": false,
},
{
"type": "string",
"name": "LastUpdatedDateTime",
"in": "query",
"format": "date-time",
"x-nullable": true
},
],
- Version used:
Tried 7.7.18 and 7.10.0 - Environment name and version:
Edge Version 116.0.1938.76 (Official build) (64-bit)
Node 18
React 18.2 - Operating System and version (desktop or mobile):
Windows 10 22H2
Just ran into this as well, would be nice if we could customise the ordering