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

Separate NormalizedUnitSpec from CompositeUnitSpec #4440

Closed
wants to merge 3 commits into from
Closed

Conversation

kanitw
Copy link
Member

@kanitw kanitw commented Jan 4, 2019

and introduce ExtendedUnitSpec = NormalizedUnitSpec | CompositeUnitSpec

This makes the typing clearer between what's normalized (supported internally) vs what's composite unit spec only.

cc: @jakevdp

Merge #4493 First

@kanitw kanitw requested review from arvind and domoritz January 4, 2019 07:27
@jakevdp
Copy link
Contributor

jakevdp commented Jan 4, 2019

sounds good

@kanitw
Copy link
Member Author

kanitw commented Jan 24, 2019

@domoritz It looks like the schema generator does not generate the right output for TopLevelFacetedUnitSpec in this branch. ("mark" and "encoding" are missing, for example.)

@domoritz
Copy link
Member

Hmm, that's bad but I don't have time to look into it until next month. Can you try to create a small test case in the schema generator repo?

@kanitw
Copy link
Member Author

kanitw commented Jan 24, 2019

I don't have time to look into it until next month.

FYI, this is extremely high priority as it's blocking several PRs downstream.
So within your limited time, better cut down time for other less important efforts.

@domoritz
Copy link
Member

Okay, I will try to make some time. Can you describe what exactly is wrong (besides "mark" and "encoding" missing?)

@kanitw
Copy link
Member Author

kanitw commented Jan 25, 2019

export type TopLevelFacetedUnitSpec = TopLevel<FacetedExtendedUnitSpec> & DataMixins;`

export type FacetedExtendedUnitSpec = ExtendedUnitSpec<FacetMapping<Field>>;

export type ExtendedUnitSpec<
  /** Extra Encoding */
  EE = EmptyObject
> = NormalizedUnitSpec<EE> | CompositeUnitSpec<EE>;

It seems like TopLevelFacetedUnitSpec currently only gets things from TopLevel, but nothing from FacetedExtendedUnitSpec.

Perhaps, the NormalizedUnitSpec<EE> | CompositeUnitSpec<EE> part is something the schema isn't smart about.

src/spec/unit.ts Outdated
export type FacetedCompositeUnitSpec = GenericUnitSpec<EncodingWithFacet<string | RepeatRef>, AnyMark>;
export type FacetedExtendedUnitSpec = ExtendedUnitSpec<FacetMapping<Field>>;

// Note: The following three lines are equivalent to:
Copy link
Member Author

Choose a reason for hiding this comment

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

@domoritz I found a workaround, so you don't have to rush to fix this.

Copy link
Member

Choose a reason for hiding this comment

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

Great. I should still look into it to make sure it’s not a problem elsewhere.

@kanitw kanitw force-pushed the kw/composite branch 3 times, most recently from 59045b6 to d74ff73 Compare January 26, 2019 05:26
}
]
},
"CompositeMarkDef": {
"CompositeMarkUnitSpec<FacetMapping>": {
Copy link
Member Author

Choose a reason for hiding this comment

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

<FacetMapping> => WithFacet

@kanitw kanitw force-pushed the kw/composite branch 2 times, most recently from 054753d to 36da7aa Compare January 27, 2019 18:52
@@ -10644,6 +12026,55 @@
],
"type": "object"
},
"TopLevelCompositeMarkUnitSpec": {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is still incorrect due to the same problem...

export type CompositeMarkUnitSpec<
  EE = {} // extra encoding parameter (for faceted composite unit spec)
> = ErrorBarUnitSpec<EE> | ErrorBandUnitSpec<EE> | BoxPlotUnitSpec<EE>;

@kanitw
Copy link
Member Author

kanitw commented Feb 10, 2019

Closing in favor of #4528, which simplify this PR and avoids splitting unit specs into multiple pieces (for now).

@kanitw kanitw closed this Feb 10, 2019
@kanitw kanitw deleted the kw/composite branch February 10, 2019 00:29
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.

None yet

3 participants