Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request parameters are always sorted by requiredness and alphabetically #2403

Open
Lexy2 opened this issue Sep 10, 2023 · 1 comment
Open
Assignees
Labels
enhancement New feature or request triaged

Comments

@Lexy2
Copy link

Lexy2 commented Sep 10, 2023

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

image

Expected Behavior

image

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

  1. Run Stoplight Elements on top of any schema that has parameters.
  2. Play with parameter ordering in the schema.
  3. 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
@Zarathustra2
Copy link

Just ran into this as well, would be nice if we could customise the ordering

@chohmann chohmann added enhancement New feature or request triaged labels Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triaged
Projects
None yet
Development

No branches or pull requests

4 participants