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

impl(generator): support more field types #61

Merged

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Nov 1, 2024

Support more field types, including several string formats.

Remove code duplication between array and scalar field handling.

Make it easier to write smaller unit tests.

Support more field types, including several string formats.

Remove code duplication between array and scalar field handling.

Make it easier to write smaller unit tests.
@coryan coryan marked this pull request as ready for review November 1, 2024 09:53

func makeStringType(messageName, name, format string, optional bool, field *base.Schema) (*genclient.Field, error) {
switch format {
case "":
Copy link
Member

Choose a reason for hiding this comment

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

should this be case "string"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. A normal string has no "format" field. Integers as strings have {"type": "string", "format": "int64"}.

I sure don't like how OpenAPI represents primitive types 🤷

@coryan coryan merged commit 9386ff4 into googleapis:main Nov 1, 2024
9 checks passed
@coryan coryan deleted the impl-generator-openapi-handle-more-field-types branch November 1, 2024 14:51
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