Skip to content

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

Merged
designatednerd merged 2 commits intoapollographql:masterfrom
CraigSiemens:custom-scalars-prefix
May 19, 2020
Merged

Added option to generate a custom scalar with a prefix.#1216
designatednerd merged 2 commits intoapollographql:masterfrom
CraigSiemens:custom-scalars-prefix

Conversation

@CraigSiemens
Copy link
Copy Markdown
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
Copy Markdown
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!

Comment thread Sources/ApolloCodegenLib/ApolloCodegenOptions.swift
/// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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