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

Feature/implement response headers v2 #1841

Conversation

elijah-roberts
Copy link
Contributor

@elijah-roberts elijah-roberts commented Nov 25, 2020

Pulling in changes from #1730 to v2

protoc-gen-swagger: Implement Response Header(s) object, Implement Field Enum,Example&Format attributes #1729

References to other Issues or PRs

#1729

Have you read the Contributing Guidelines?

Yes

Brief description of what is fixed or changed

I have implemented the following:

  • openapi headers object proto
  • openapi header object proto, implementing the Description, Type, Format, Default, and Pattern fields
  • updated the response proto to use the headers/header objects
  • updated the jsonSchema proto to implement the Format, Example and Enum fields
  • implemented/updated template structs to match the above proto changes
  • implemented validation of Type field (must be one of Integer, Number, Boolean, String)
  • implemented validation of Default field(any.Any type that must match the Type field)
  • created tests to cover Header(s) logic, and validation functions
  • updated example proto with example usage for adding headers, and using added fields

Other comments

Per the contributing guidelines I run the 2 docker commands, and attached the updated files to my PR

johanbrandhorst and others added 20 commits October 10, 2020 16:01
Not even sure if renovate cares to check this branch
but it can't hurt.
* a bunch of whitespace/format changes... have since added this to my IDE
* remove any.Any objects, and convert them to string
* move runtime regex strings to global variables
* update examples
* update tests
* remove regex logic, and update functions to use simple booleans
* cleanup example proto
* enforce CanonicalMIMEHeaderKey for header name
simplifying string check

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
fix: remove string comparisons

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
* parse unsigned ints with strconv.ParseUint
* update unqoute logic
@google-cla
Copy link

google-cla bot commented Nov 25, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@elijah-roberts
Copy link
Contributor Author

@googlebot I consent.

@google-cla
Copy link

google-cla bot commented Nov 25, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@johanbrandhorst
Copy link
Collaborator

@googlebot I consent.

@google-cla google-cla bot added cla: yes and removed cla: no labels Nov 25, 2020
Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this, I hope it wasn't too much trouble adapting from v1 to v2 😄. This PR still looks great!

@johanbrandhorst johanbrandhorst merged commit 865774a into grpc-ecosystem:master Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants