Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

JSON Schema Support #123

Merged
merged 14 commits into from
Jul 22, 2022
Merged

JSON Schema Support #123

merged 14 commits into from
Jul 22, 2022

Conversation

mvpatel2000
Copy link
Contributor

@mvpatel2000 mvpatel2000 commented Jul 20, 2022

  • Lets YAHP autogenerate JSON Schemas
  • Supports static validation through function call and CLI

Associated JIRAs

Copy link
Contributor

@ravi-mosaicml ravi-mosaicml left a comment

Choose a reason for hiding this comment

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

Cool work! See comments.

In addition, for test cases, can you dump the kitchen sink hparams jsonschema to a file as a test fixture, and validate the kitchen sink hparams yaml against that? See https://github.com/mosaicml/yahp/blob/a3d21be2c810b95e56492548b11583f37a41de72/tests/fixtures/commented_map.yaml

meta.yaml Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
tests/test_json_schema.py Outdated Show resolved Hide resolved
tests/test_json_schema.py Outdated Show resolved Hide resolved
tests/test_json_schema.py Outdated Show resolved Hide resolved
yahp/hparams.py Outdated Show resolved Hide resolved
yahp/hparams.py Show resolved Hide resolved
yahp/hparams.py Show resolved Hide resolved
yahp/utils/type_helpers.py Outdated Show resolved Hide resolved
yahp/utils/type_helpers.py Outdated Show resolved Hide resolved
@ravi-mosaicml
Copy link
Contributor

Forgot to say, but can you also set the description field and populate it with the desc field that is passed into hp.optional / hp.required?

mvpatel2000 and others added 9 commits July 20, 2022 11:18
Co-authored-by: ravi-mosaicml <ravi@mosaicml.com>
Co-authored-by: ravi-mosaicml <ravi@mosaicml.com>
Co-authored-by: ravi-mosaicml <ravi@mosaicml.com>
@mvpatel2000
Copy link
Contributor Author

Would like a careful review on the logic here. A lot of subtle type stuff going on, and I'm still not 100% familiar with autoyahp / hparams_registry so there could be logic errors

Copy link
Contributor

@ravi-mosaicml ravi-mosaicml left a comment

Choose a reason for hiding this comment

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

Wow -- you're fast. Overall this looks fine, but I would like to see the json schema for the kitchen sink hparams. Would be good to also manually validate this against some of the yamls used in composer to make sure it is compatbile.

yahp/create_object/argparse.py Outdated Show resolved Hide resolved
yahp/hparams.py Outdated Show resolved Hide resolved
yahp/hparams.py Outdated Show resolved Hide resolved
yahp/utils/json_schema_helpers.py Outdated Show resolved Hide resolved
yahp/utils/json_schema_helpers.py Outdated Show resolved Hide resolved
yahp/utils/json_schema_helpers.py Outdated Show resolved Hide resolved
yahp/utils/json_schema_helpers.py Outdated Show resolved Hide resolved
yahp/utils/json_schema_helpers.py Show resolved Hide resolved
yahp/utils/json_schema_helpers.py Show resolved Hide resolved
yahp/utils/json_schema_helpers.py Outdated Show resolved Hide resolved
@mvpatel2000 mvpatel2000 merged commit 8d1880e into main Jul 22, 2022
@mvpatel2000 mvpatel2000 deleted the mvpatel2000/json-schema branch July 22, 2022 18:04
@mvpatel2000 mvpatel2000 restored the mvpatel2000/json-schema branch July 28, 2022 18:18
mvpatel2000 added a commit that referenced this pull request Jul 28, 2022
@mvpatel2000
Copy link
Contributor Author

Reverting and pushing to dev

mvpatel2000 added a commit that referenced this pull request Jul 28, 2022
@mvpatel2000 mvpatel2000 deleted the mvpatel2000/json-schema branch July 28, 2022 18:35
mvpatel2000 added a commit that referenced this pull request Jul 28, 2022
* JSON Schema Support (#123)

* yaml validation

* fix lint and typing

* add IO tests

* update installs

* Update meta.yaml

Co-authored-by: ravi-mosaicml <ravi@mosaicml.com>

* Update setup.py

Co-authored-by: ravi-mosaicml <ravi@mosaicml.com>

* Update yahp/hparams.py

Co-authored-by: ravi-mosaicml <ravi@mosaicml.com>

* resolve multiple comments

* support autoyahp

* add optional support

* support registries

* switch to anyOf

* nits and kitchen sink test

Co-authored-by: ravi-mosaicml <ravi@mosaicml.com>

* fix schema generator

* fix lint

* support singletons in list

* support + syntax

* add list test

* add validation to create as default

* fix many tests

* compressed schemas

* fix comments

* update yahp with autoyahp

* make schema sorted

* missing copy

* change enum

* don't shortcut primitives

* more aggressively type def

* checkdown

* checkdown

* simplify cls_def

* allow recursion

* remove singleton shortcutting

* add param and param prop

* stack properties

* one more round of comments

* support type insensitive regex

Co-authored-by: ravi-mosaicml <ravi@mosaicml.com>
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.

2 participants