oxidecomputer / oxidecomputer/progenitor
Ordering of parameters in generated method calls are alphabetically sorted unexpectedly
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 136
- Avg merge
- 8h 36m
- Merged PRs (30d)
- 14
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in progenitor-impl/src/method.rs around the referenced line, where generated method parameters are assembled. Compare that ordering with the parameters listed in the OpenAPI example and trace how the generated Rust signature is produced. Done means generated calls retain the OpenAPI parameter order instead of sorting arguments alphabetically.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, rust
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100