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

Ordering of parameters in generated method calls are alphabetically sorted unexpectedly #824

Open
drahnr opened this issue Jun 6, 2024 · 0 comments

Comments

@drahnr
Copy link
Contributor

drahnr commented Jun 6, 2024

Working with another OpenAPI spec, utilizing arguments like startTime and endTime, the ordering of arguments is arbitrary in the generated calls. That's rather unfortunate.

I.e.

      parameters:
        - $ref: '#/components/parameters/asset'
        - $ref: '#/components/parameters/sym'
        - name: uId
          in: query
          description: the tranId in  `POST /foo/v1/bar`
          schema:
            type: integer
            format: int64
            example: 123456789
        - $ref: '#/components/parameters/startTime'
        - $ref: '#/components/parameters/endTime'
        - $ref: '#/components/parameters/current'
        - $ref: '#/components/parameters/size'
        - $ref: '#/components/parameters/archived'
        - $ref: '#/components/parameters/recvWindow'

becomes alphabetically sorted:

    pub async fn placeholder<'a>(
       &'a self,
       archived: Option<&'a str>,
       asset: &'a str,
       current: Option<i32>,
       end_time: Option<i64>, // <<<<<<<<
       isolated_symbol: Option<&'a str>,
       recv_window: Option<i64>,
       signature: &'a str,
       size: Option<i32>,
       start_time: Option<i64>,  // <<<<<<<< 
       timestamp: i64, 
       tx_id: Option<i64>,

which is counter intuitive and presume caused by https://github.com/drahnr/progenitor/blob/d9da8af7407b14f153e973eaf2e2acfda83bd0cb/progenitor-impl/src/method.rs#L2411

Exptectation:

Retain ordering of the OpenAPI spec

@drahnr drahnr changed the title Ordering of values in method calls shuffled Ordering of parameters in generated method calls are alphabetically sorted Jun 6, 2024
@drahnr drahnr changed the title Ordering of parameters in generated method calls are alphabetically sorted Ordering of parameters in generated method calls are alphabetically sorted unexpectedly Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant