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

Consider switching "alias" annotation to "json" #908

Closed
alecthomas opened this issue Feb 9, 2024 · 1 comment · Fixed by #943
Closed

Consider switching "alias" annotation to "json" #908

alecthomas opened this issue Feb 9, 2024 · 1 comment · Fixed by #943
Assignees

Comments

@alecthomas
Copy link
Collaborator

alecthomas commented Feb 9, 2024

The rationale is twofold:

  1. It is almost certain that if a type is to be shared across multiple ingress methods, such as HTTP, gRPC, and GraphQL, users will want to be able to use different aliases for different protocols. The choice of alias doesn't allow for that.
  2. It will simplify interacting with HTTP ingress endpoints from Go code such as integration tests, because their will only need to be a single annotation, json:"xyz".

Schema should change to:

data Foo {
  field String alias http bar
}

verb bar() 
  ingress http GET /bar

Go annotations should change to:

json:"bar"

Kotlin annotation should change to something like this, but dig into whether we should just use @JsonProperty? Is this part of JAX-RS or some random thing from Jackson?

@JsonProperty("bar")

Edit: there doesn't seem to be any standard at all. Gson uses SerializedName, Jackson uses @JsonProperty - let's just use @Json.

@github-actions github-actions bot added the triage Issue needs triaging label Feb 9, 2024
@alecthomas alecthomas added next Work that will be be picked up next and removed triage Issue needs triaging labels Feb 12, 2024
@github-actions github-actions bot removed the next Work that will be be picked up next label Feb 14, 2024
@wesbillman
Copy link
Member

Yeah after a bit of googling and chatting with my friend Chad, it seems like there's no standard for this. There are standards for serializing, but they leave out the part about this being for JSON on http. So @Json sounds good to me as well 👍

wesbillman added a commit that referenced this issue Feb 15, 2024
Fixes #908

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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 a pull request may close this issue.

2 participants