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

Feature/toplevel document type #293

Merged
merged 6 commits into from Oct 20, 2017
Merged

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Oct 20, 2017

This supports type: 'document' which is in essence an alias for object types, but will be the only types that can be created as documents (with _id), and will also be the only types listed in the side panel by default.

This is backwards compatible, except for a little potential surprising side effect: if you now define a new document type in your schema without renaming the existing object types, all the existing object types will disappear from the sidebar by default. The solution is to change the type of the object types that you want to be documents from object to document.

I can't think of an easy way to fix this, but maybe its acceptable as long as we document how to fix it? What do you think?

@simen
Copy link
Member

simen commented Oct 20, 2017

I think the surprising behaviour is acceptable. We will make it clear in the documentation wherever document is mentioned.

Copy link
Member

@simen simen left a comment

Choose a reason for hiding this comment

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

Looks awesome as far as I can tell.

Copy link
Contributor

@thomax thomax left a comment

Choose a reason for hiding this comment

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

A substantial UX improvement on a small code footprint!

@bjoerge bjoerge force-pushed the feature/toplevel-document-type branch from a02fc61 to 4fa9604 Compare October 20, 2017 14:07
@bjoerge
Copy link
Member Author

bjoerge commented Oct 20, 2017

I've added a console-warning if there are document-types in the schema and hiddenTypes in the data-aspects config is set and non-empty (thanks to @rexxars for the suggestion). This is a step forward on our path to retire data-aspects.

I've also written a help page for this: https://sanity.io/help/toplevel-objects-to-document-type

Good to merge?

Copy link
Member

@rexxars rexxars left a comment

Choose a reason for hiding this comment

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

Solid work! 👍

@bjoerge bjoerge merged commit 44f1a43 into next Oct 20, 2017
@bjoerge bjoerge deleted the feature/toplevel-document-type branch October 20, 2017 14:18
bjoerge added a commit that referenced this pull request Oct 25, 2017
* [schema] Support type: document

* [base] Change type of bundled types to document

* [data-aspects] Make getInferredTypes only return document types if schema has any defined document types

* [data-aspects] Warn if encountering both document types and a hiddentTypes config

* [cli] Remove update movies-schema and remove hiddenTypes from moviesdb template

* [misc] Remove references to hiddenTypes config
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

4 participants