-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Auto-generate JSON Schema from TypeScript #27
Auto-generate JSON Schema from TypeScript #27
Conversation
Also added the GitHub actions template to autogenerate this file
…ditionalProperties is set to false
…ma' into enhancement/generate-json-schema
InstallationJetBrainsSettings -> Languages & Frameworks -> Schemas and DTDs -> JSON Schema Mappings: Set Schema file or URL to https://github.com/alexiswl/cwl-ts-auto/blob/enhancement/generate-json-schema/cwl_schema.json Set Schema Version to 'JSON Schema version 7' Click Apply VSCode
The settings.json can be accessed via the command pallete. We also need to update the files.associations so that .cwl files are seen as YAML files by the compiler. {
"yaml.schemas": {
"https://raw.githubusercontent.com/alexiswl/cwl-ts-auto/enhancement/generate-json-schema/cwl_schema.json": "*.cwl"
},
"files.associations": {
"*.cwl": "yaml"
}
} UsesHighlight invalid keysShow documentationProvide Valid Suggestions |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## enhancement/auto-generate-json-schema-from-ts #27 +/- ##
==============================================================================
Coverage 55.62% 55.62%
==============================================================================
Files 127 127
Lines 7837 7837
Branches 1572 1572
==============================================================================
Hits 4359 4359
Misses 3111 3111
Partials 367 367
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Fix with https://github.com/EndBug/add-and-commit?tab=readme-ov-file#working-with-prs by running checkout with rep / ref when triggered from a PR
…ma' into enhancement/generate-json-schema
Ah makes sense, this is a cross-fork write out error. Can we merge this into a branch on the origin repo first and then retry the GH action test? I don't think I have permission to make a branch on this repository |
@alexiswl I sent you an invitation to join https://github.com/orgs/common-workflow-lab/teams/people/members which gives you permission to make branches in this and many other CWL repos. Feel free to re-open this PR from a local branch and thanks again for your contributions! |
@@ -0,0 +1,6270 @@ | |||
{ | |||
"$ref": "#/definitions/CWLFile", | |||
"$schema": "http://json-schema.org/draft-07/schema#", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any advantages to producing a schema using the newer drafts of the JSON schema spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially, JetBrains only seems to support version 7 though from the drop down menus, but I don't know if they actually support more recent versions (2019 and 2020). From the JSON Schema Store, GitHub Actions schema is also on version 7 still
Allow for type to be the string for unnamed map, Allow for type to be the array for unnamed map Allow pattern string for SecondaryFile def Fixed record field maps Fixed schema field maps (related to record field maps) Fixed EnvVar requirement Allowed for a few extra miscell metadata types
Updated base branch to equivalent branch name on the common-workflow-lab/cwl-ts-auto repo. Merging and will then create the PR to main from the common-workflow-lab branch instead. |
84a192a
into
common-workflow-lab:enhancement/auto-generate-json-schema-from-ts
Summary
Schema refining process steps
Remove loadingOptions and extensionFields properties
Rename
class_
,type_
etc toclass
,type
Add
$import
and$include
options and update requirements that allow for them (SchemaDefRequirementa and InlineJavascriptRequirement)Fix inputs / outputs / steps, so not just an array but can be an object where the key is the
id
attribute.Fix Requirements / Hints, so not just an array but can be an object where the key is the
class
attribute.Fix descriptions by removing Auto-generated... from the start
Generate the CWLFile definition, which can be one of Workflow, CommandLineTool, or ExpressionTool and also fits the CWLMetadata
Fix issues with additionalProperties and nested definitions as shown here https://stoic-agnesi-d0ac4a.netlify.app/1
Write out the schema
Generate the CWLGraph definition, which is an array of CWLFile objects with CWLMetadata
Write out the graph schema to a separate file