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

feat: Support x-go-name property extension #517

Merged
merged 1 commit into from Apr 19, 2022

Conversation

emilekm
Copy link
Contributor

@emilekm emilekm commented Feb 4, 2022

This implements a feature requested in #468.

The extension name x-go-name comes from go-swagger.

Example schema:

components:
  schemas:
    Person:
      type: object
      properties:
        id:
          type: string
          x-go-name: ID
        pet_id:
          type: string
          x-go-name: PetID

Output:

type Person struct {
	ID string `json:"id"`
	PetID string `json:"pet_id"`
}

@octomad
Copy link
Contributor

octomad commented Feb 8, 2022

Excellent. Exactly what was needed.

@octomad
Copy link
Contributor

octomad commented Feb 18, 2022

Just checking in. Will this be merged soon?

@Penthious
Copy link

Also checking when this will be merged in.

@deepmap-marcinr deepmap-marcinr merged commit dcb982c into deepmap:master Apr 19, 2022
@Jacob-Roberts
Copy link

This has broken the generated code. The types file that is created will correctly respect this. But the client that is generated will use the non-x-go-name version

@emilekm
Copy link
Contributor Author

emilekm commented May 15, 2022

This has broken the generated code. The types file that is created will correctly respect this. But the client that is generated will use the non-x-go-name version

Could you provide a sample of the code that is broken? I don't think it's broken and you are referring to URL parameters (since query params work fine).

E: the referenced MR isn't passing the tests, but it should fix your particular problem (if I am correct in my assesment)

@emilekm
Copy link
Contributor Author

emilekm commented Oct 11, 2022 via email

adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 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

Successfully merging this pull request may close these issues.

None yet

5 participants