Skip to content

Conversation

clinta
Copy link
Contributor

@clinta clinta commented Apr 13, 2025

I have:

  • Written a clear PR title and description (above)
  • Signed the Khan Academy CLA
  • Added tests covering my changes, if applicable
  • Included a link to the issue fixed, if applicable
  • Included documentation, for new features
  • Added an entry to the changelog

This implements the feature requested in issue Khan#367, allowing users to specify a custom name for a field in the generated Go code without creating an alias in the GraphQL query. This is especially useful when working with GraphQL servers that limit the number of aliases that can be used.
@csilvers
Copy link
Member

Hi @clinta , thank you for your contribution! Can you separate the last item ("Fixed path handling in file globbing to properly normalize paths") into its own PR? I suspect that will be easier/faster to get in than the others.

Ideally, you'd have three PRs, so we could consider the camel-case and the alias changes separately. I know those might be more intertwined, but hopefully it's not that much work.

@clinta
Copy link
Contributor Author

clinta commented Apr 13, 2025

That's my mistake on the changelog. I was reviewing and summarizing differences between main, but I was looking at my main which hadn't pulled recent changes, after I already rebased this branch. So when I was reviewing changes, that looked like a change that needed to be included in the changelog for this PR. I fixed that.

I should be able to split up the alias and snake_case option into separate PRs.

@clinta clinta changed the title Add field aliasing and auto_camel_case for snake_case conversion Add field aliasing Apr 13, 2025
@clinta
Copy link
Contributor Author

clinta commented Apr 13, 2025

This is now a focused PR just on adding the alias directive. I'll open another PR based on top of this with the snake_case conversion feature.

@clinta clinta mentioned this pull request Apr 13, 2025
6 tasks
@benjaminjkraft
Copy link
Collaborator

Thanks for splitting this out, it's very clean now! (I'm still sad we need it, but oh well, that's life being a client.)

@benjaminjkraft benjaminjkraft merged commit bc17161 into Khan:main Apr 13, 2025
4 checks passed
benjaminjkraft pushed a commit that referenced this pull request Apr 14, 2025
This builds on top of #376 by adding a configuration option to
automatically convert all snake_case type and field names to CamelCase.
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.

Customize field names without alias

3 participants