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

[Task] Check and publish the JSON Schema definition #183

Open
taorepoara opened this issue May 7, 2024 · 6 comments
Open

[Task] Check and publish the JSON Schema definition #183

taorepoara opened this issue May 7, 2024 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@taorepoara
Copy link
Member

taorepoara commented May 7, 2024

What should be done

In order to make it checkable and simple to understand, create a JSON Schema of the configuration file and publish it to SchemaStore to allow auto-completion in IDE.

Technical recommandation

There are two ways to add the schema:

  • include it into the repo and update it through PRs
  • include a link to the self-hosted schema

IMO, the best may is to generate the schema and include it into the release artifacts, and define it as self-hosted with the latest release artefact as URL.

Ecological concerns

It might be better to have a single file instead of merging it at release time since it might not change a lot, but generating the schema with schemars would avoid errors.

Is this task linked with any other ?

@taorepoara taorepoara added enhancement New feature or request good first issue Good for newcomers labels May 7, 2024
@taorepoara
Copy link
Member Author

Be careful to enum generation. It doesn't seems to work fine

@taorepoara
Copy link
Member Author

Also upgrade the README documentation

@taorepoara
Copy link
Member Author

The best way would be to generate Markdown from JSON Schema or create a documentation website with docausorus: https://json-schema.org/implementations#documentation-generators

@taorepoara taorepoara changed the title [Task] Create the JSON Schema definition [Task] Check and publish the JSON Schema definition Aug 22, 2024
@taorepoara
Copy link
Member Author

taorepoara commented Aug 23, 2024

Might be interesting of renaming the definition with serde or schemars rename attribute: https://graham.cool/schemars/deriving/attributes/#rename
And also, adding some examples with the example attribute: https://graham.cool/schemars/deriving/attributes/#example

@taorepoara
Copy link
Member Author

Renaming is done.

A markdown generation could be nice:

bunx @adobe/jsonschema2md --input docs -n -o docs/schema

This needs to imrpove custom schemas (VecPatch, ParsableStruct...) to use $ref

@taorepoara
Copy link
Member Author

taorepoara commented Aug 29, 2024

Full doc generation:

mkdir -p docs
cargo run -F cli -F json-schema -- schema > docs/dofigen.schema.json
sed -i -E 's/("[$]ref"[:] ")/\1.\/dofigen.schema.json#/g' docs/dofigen.schema.json
bunx @adobe/jsonschema2md --input docs -n -o docs/schema

The generated doc is not great...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
Status: 🟡 Backlog
Development

No branches or pull requests

1 participant