Skip to content

swap username and password in LoginRequest#62

Merged
FloSch62 merged 1 commit intosrl-labs:mainfrom
mxyns:swap-user-pass
Feb 8, 2026
Merged

swap username and password in LoginRequest#62
FloSch62 merged 1 commit intosrl-labs:mainfrom
mxyns:swap-user-pass

Conversation

@mxyns
Copy link
Contributor

@mxyns mxyns commented Feb 6, 2026

addresses Issue #61

basically swaps user and pass so autogenerated code has constructors with the username as the first parameter

@FloSch62 FloSch62 merged commit 5db0a61 into srl-labs:main Feb 8, 2026
1 check passed
@FloSch62
Copy link
Member

FloSch62 commented Feb 8, 2026

@mxyns thanks

@mxyns
Copy link
Contributor Author

mxyns commented Feb 10, 2026

hi @FloSch62,
as you mentioned in #67, changing the swagger directly has no effect. the effect of this PR was quickly reverted by the next generation of swagger.

I have found that the fields generated by swaggo/swag are ordered by alphabetical order, explaining why username is after password in the generated swagger. There is a way to force the ordering by adding extensions:x-order=0 to the fields, but that only reorders in the .json file. It seems like the .yml does not respect that extension for some reason.

Would it be okay to have the .yml and .json with different field ordering until this is fixed?

@FloSch62
Copy link
Member

FloSch62 commented Feb 10, 2026

@mxyns

I am not sure, if swaggo will "fix" this...

see:
swaggo/swag#1737
swaggo/swag#715

Since the x-order extension only affects .json and not .yaml, I'd rather keep them consistent and not introduce a difference between the two formats. OpenAPI properties are inherently unordered (they're JSON objects/maps), so code generators that rely on property ordering are technically not spec-compliant. I think we can accept the alphabetical ordering as a swaggo limitation for now. If swaggo fixes the YAML side in the future, we can revisit adding x-order tags at that point.

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

Successfully merging this pull request may close these issues.

2 participants