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

Follow datatype aliases when generating a JSON Schema #27

Open
timothee-haudebourg opened this issue Jul 27, 2022 · 0 comments
Open

Follow datatype aliases when generating a JSON Schema #27

timothee-haudebourg opened this issue Jul 27, 2022 · 0 comments
Labels
enhancement New feature or request scope:gen:json-schema Related to the JSON Schema generator

Comments

@timothee-haudebourg
Copy link
Collaborator

Consider the following layout:

// example/basic_post.tldr
base <https://example.com/>;
use <https://schema.org/> as schema;

layout BasicPost for schema:BlogPosting {
	/// Title of the post.
	schema:title: schema:Text,

	/// Content of the post.
	schema:body: schema:Text
}

For now it generates the fololwing JSON Schema:

{
	"$id": "https://example.com/BasicPost",
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"properties": {
		"body": {
			"description": "Content of the post.",
			"$ref": "https://schema.org/Text"
		},
		"title": {
			"description": "Title of the post.",
			"$ref": "https://schema.org/Text"
		}
	},
	"title": "Basic Blog Post.",
	"type": "object"
}

However it would be preferable to replace "$ref": "https://schema.org/Text" by "type": "string" directly, by following the datatype alias.

@timothee-haudebourg timothee-haudebourg added enhancement New feature or request scope:gen:json-schema Related to the JSON Schema generator labels Jul 27, 2022
@timothee-haudebourg timothee-haudebourg self-assigned this Nov 11, 2022
@timothee-haudebourg timothee-haudebourg removed their assignment Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scope:gen:json-schema Related to the JSON Schema generator
Projects
None yet
Development

No branches or pull requests

1 participant