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

Added option to generate a custom scalar with a prefix. #1216

Merged

Conversation

CraigSiemens
Copy link
Contributor

@CraigSiemens CraigSiemens commented May 19, 2020

Fixes #1214

Added an option to ApolloCodegenOptions to take a CustomScalarFormat enum which can be either default, passthrough or passthroughWithPrefix(String)

Copy link
Contributor

@designatednerd designatednerd left a comment

Choose a reason for hiding this comment

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

Oooh - yeah I like this better. It's a breaking change but I think in a good way. Gonna close mine out!

/// Enum to select how to handle properties using a custom scalar from the schema.
public enum CustomScalarFormat: Equatable {
/// Uses a default type instead of a custom scalar.
case `default`
Copy link
Contributor

Choose a reason for hiding this comment

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

I would call this none rather than default, since it's applying no formatting to custom scalars.

@designatednerd
Copy link
Contributor

The test failure is a known flaky test, FYI

- Renamed CustomScalarFormat.default to none since it isnt applying any formatting.
- Added the passthroughCustomScalars flag when using passthroughWithPrefix to be safe. The CLI documentation doesnt mention that that flag is added when using customScalarsPrefix.
Copy link
Contributor

@designatednerd designatednerd left a comment

Choose a reason for hiding this comment

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

LGTM pending the kicked build - will probably merge this tomorrow. Thanks for pointing this out!

@designatednerd designatednerd added this to the Next Release milestone May 19, 2020
@designatednerd designatednerd merged commit aa65d09 into apollographql:master May 19, 2020
@CraigSiemens CraigSiemens deleted the custom-scalars-prefix branch May 19, 2020 17:30
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.

ApolloCodegenLib doesn't include an equivalent option for customScalarsPrefix
2 participants