Skip to content

Placeholder type #74

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

Merged
merged 5 commits into from
Nov 22, 2016
Merged

Placeholder type #74

merged 5 commits into from
Nov 22, 2016

Conversation

bergie
Copy link
Contributor

@bergie bergie commented Nov 22, 2016

Add definition for the placeholder type, and require contentblocks to match one of the subtypes (which now provide stricter enums on allowed types)

@bergie
Copy link
Contributor Author

bergie commented Nov 22, 2016

@jonnor @automata please review

example: "text"
type: string
enum:
- code
Copy link
Contributor

Choose a reason for hiding this comment

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

code in image?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, could move that to text

enum:
- text
- hr
- unknown
Copy link
Contributor

Choose a reason for hiding this comment

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

What is unknown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unknown is a unknown block type. Allowed in schema for HTML block types html-flatten can't classify, but dropped before solving

- code
- quote
- hr
- unknown
Copy link
Contributor

@jonnor jonnor Nov 22, 2016

Choose a reason for hiding this comment

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

@bergie is it guaranteed that unknown blocks have all the properties of a text block? If yes, why isn't it just called type: text?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unknown is called unknown because it is a block type html-flatten doesn't support. We know it has the minimum information available, but don't know how it should be rendered/enriched

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok

"$ref": "contentblock.json#/definitions/type"
description: Block type
example: "text"
type: string
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, trying to understand here these changes to type: contentblock still defines what are the possible types of blocks, however each block (e.g. cta) should define explicitly its type instead of depending on any kind of type from contentblock. Right?

Does it means that before this change a cta block could has any type like h1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@automata before this PR, any block would be valid as long as it passed the rules of any block type. So image would be valid if it can pass text validations. Using stricter enum causes them to have to validate against the schema of the correct block type(s).

@bergie bergie merged commit b190375 into master Nov 22, 2016
@bergie bergie deleted the placeholder_type branch November 22, 2016 14:40
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