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

Add json-schema notation for config #9879

Closed
wants to merge 1 commit into from
Closed

Add json-schema notation for config #9879

wants to merge 1 commit into from

Conversation

askirmas
Copy link

Add config's JSON Schema to website available by https:://jestjs.io/jest.schema.json

Motivation

  • Documentation hints during typing
    Screenshot from 2020-04-24 11-11-58

  • JSON Schema root property "examples" for popular 'snippets'

TBD

  • One source of truth for website documentation, CLI help and jest init. During collecting I found some contradictions in transform, testPathPattern and coverageProvider.

@facebook-github-bot
Copy link
Contributor

Hi @askirmas!

Thank you for your pull request and welcome to our community.We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@codecov-io
Copy link

Codecov Report

Merging #9879 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #9879   +/-   ##
=======================================
  Coverage   64.50%   64.50%           
=======================================
  Files         291      291           
  Lines       12361    12361           
  Branches     3057     3055    -2     
=======================================
  Hits         7974     7974           
  Misses       3745     3745           
  Partials      642      642           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6cbd3cb...a79eaaf. Read the comment docs.

@SimenB
Copy link
Member

SimenB commented Apr 24, 2020

Oh this is cool! How can we keep it up to date? Can we generate it from TS types or something so it always reflects the code?

During collecting I found some contradictions

Can we fix those?

@askirmas
Copy link
Author

Producing MD, TS, stdout for --help, etc from JsonSchema is MUCH easier task than vice versa. I can add it in a while.

From TS - that exactly i'm playing with. But AST.parser officially raw so my brains are burning.

@jeysal
Copy link
Contributor

jeysal commented Apr 24, 2020

I remember there was a tool called typescript-json-schema I think that worked pretty well for any setup since it also used proper TS APIs

@connectdotz
Copy link
Contributor

hi, we have a PR (jest-community/vscode-jest#638) aimed to add jest json config validation/code-assistance in vscode. I think it is a great idea but it uses the schema hosted in @askirmas repo instead of jest's official repo. For accuracy and long-term maintenance, I think it is much desired to host in here as part of jest release process.

Noticed this PR and wondering if @askirmas can address the issues @SimenB mentioned above so we can get the schema into the official repo?

@askirmas
Copy link
Author

What to do with this issue?

@SimenB
Copy link
Member

SimenB commented Dec 24, 2020

I believe the missing part is generating this rather than having some hand made thing. Also, a separate PR for any errors you found would be great

@askirmas
Copy link
Author

askirmas commented Dec 24, 2020

Well, I prefer much more the opposite way - to generate/evaluate code from data. In this case, jsonSchema is the source, .d.ts is generated // event better - evaluated with TypeScript expression but it is a very hard task
Also question about markdown files if not support them manually

@SimenB
Copy link
Member

SimenB commented Sep 9, 2021

Seems the bot closed this instead of retargeting when we renamed master to main - feel free to open up a new PR

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants