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

[schema] Ignore empty strings in example value creation #12646

Merged

Conversation

stefanprobst
Copy link
Contributor

This is for #11480

For compatibility with current master, don't treat empty strings as String type, but ignore them in example value creation. Possibly revisit this for Gatsby v3.

@stefanprobst stefanprobst requested a review from a team as a code owner March 18, 2019 16:14
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

I've tested this and this does work.

The problem in master is that it's not really that we filter out empty strings ... because we don't (so we can hit this problem in master - it depends on node order) - problem is that we handle date string at later stage in master.

One thing that I also found this is a bit tangential (when I was checking some contrived examples):

type.split(`,`).forEach(t => acc.add(t))

is problematic when type is something like [[date],[string]] - is this will generate types: date] and [string (unwrapping removes brackets at the start and end but not in the middle. I workarounded it by doing this hacky stuff:

type.split(`,`).forEach(t => acc.add(t.replace(/[\[\]]/g, ``)))

@freiksenet freiksenet merged commit 78cbab4 into gatsbyjs:schema-refactor-new Mar 19, 2019
@stefanprobst stefanprobst deleted the ignore-empty-strings branch July 8, 2019 14:50
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.

3 participants