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

feat: automatically generate OSCAL types from JSON Schema #765

Merged
merged 11 commits into from
Apr 12, 2023

Conversation

kylelaker
Copy link
Contributor

@kylelaker kylelaker commented Apr 7, 2023

This adds a new package @easydynamics/oscal-types that will convert
the underlying OSCAL JSON schema to TypeScipt type definitions. It also
replaces two existing instances of type information in oscal-react-library
with these new types: Properties and BackMater within oscal-utils.

The types are represented literally. This includes things like
media-type rather than making it the friendlier mediaType.
Additionally, to encourage good hygiene, all types are represented as
readonly.

Closes: #763

This adds a new package `@easydynamics/oscal-types` that will convert
the underlying OSCAL JSON schema to TypeScipt type definitions. It also
replaces two existing instances of type information in `oscal-react-library`
with these new types: Properties and BackMater within `oscal-utils`.

The types are represented _literally_. This includes things like
`media-type` rather than making it the friendlier `mediaType`.
Additionally, to encourage good hygiene, all types are represented as
`readonly`.
@kylelaker
Copy link
Contributor Author

kylelaker commented Apr 7, 2023

To do:

  • Automatically update the types in a GitHub workflow
  • Ensure there aren't other low-hanging fruit in the OSCAL React Library to adopt types

@kylelaker kylelaker marked this pull request as ready for review April 7, 2023 23:43
@easy-dynamics-oscal-automation easy-dynamics-oscal-automation bot requested a review from a team April 7, 2023 23:43
Copy link
Contributor

@tuckerzp tuckerzp left a comment

Choose a reason for hiding this comment

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

This looks really good so far and is super exciting! Is there anything else that needs to be done before moving this to review?

@easy-dynamics-oscal-automation easy-dynamics-oscal-automation bot requested a review from a team April 10, 2023 13:35
scripts/generate-types.ts Outdated Show resolved Hide resolved
scripts/generate-types.ts Outdated Show resolved Hide resolved
Co-authored-by: Kyle Laker <klaker@easydynamics.com>
@easy-dynamics-oscal-automation easy-dynamics-oscal-automation bot requested a review from a team April 10, 2023 16:41
@easy-dynamics-oscal-automation easy-dynamics-oscal-automation bot requested a review from a team April 11, 2023 14:30
Copy link
Contributor

@tuckerzp tuckerzp left a comment

Choose a reason for hiding this comment

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

This is a super cool change and I got to learn more about lerna while reviewing!

Opps did not mean to approve twice...

@easy-dynamics-oscal-automation easy-dynamics-oscal-automation bot requested a review from a team April 11, 2023 14:42
@Bronstrom Bronstrom force-pushed the kyle/autogenerate-types-package branch from af425e3 to d42b209 Compare April 12, 2023 15:40
@kylelaker kylelaker force-pushed the kyle/autogenerate-types-package branch from d42b209 to 21626b8 Compare April 12, 2023 18:20
@kylelaker kylelaker merged commit c0ea87e into develop Apr 12, 2023
4 checks passed
@kylelaker kylelaker deleted the kyle/autogenerate-types-package branch April 12, 2023 18:45
@kylelaker kylelaker added the enhancement New feature or request label Jun 12, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a package with TypeScript types generated from the OSCAL JSON Schema
3 participants