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

WIP: use json schema for json schema #293

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

WIP: use json schema for json schema #293

wants to merge 7 commits into from

Conversation

ahl
Copy link
Collaborator

@ahl ahl commented May 13, 2023

This is a WIP PR related to #289 and #290. We can successfully generate code from the JSON schema draft 7 schema... but the code doesn't compile and is lacking in a couple of ways. This PR is to track those deficiencies.

UPDATE: the code is now generating cleanly and compiling. There are still some aspect that aren't well represented in the Rust output.

UPDATE 9/2023: the output is looking pretty good with maybe one or two quirks, but this seems good enough to merge.

typify/tests/schemas/reflexive.rs Show resolved Hide resolved
typify/tests/schemas/reflexive.rs Show resolved Hide resolved
typify/tests/schemas/reflexive.rs Show resolved Hide resolved
typify/tests/schemas/reflexive.rs Outdated Show resolved Hide resolved
typify/tests/schemas/reflexive.rs Outdated Show resolved Hide resolved
Comment on lines +409 to +411
pub(super) fn default_bool<const V: bool>() -> bool {
V
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this seems to be unused

Comment on lines +75 to +76
#[serde(default = "defaults::core_schema_meta_schema_object_items")]
items: CoreSchemaMetaSchemaObjectItems,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure why other types like this are Option<T> and this is not.

Comment on lines +186 to +187
Variant0(Box<CoreSchemaMetaSchema>),
Variant1(SchemaArray),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wish these were

pub enum CoreSchemaMetaSchemaObjectItems {
    CoreSchemaMetaSchema(Box<CoreSchemaMetaSchema>),
    SchemaArray(SchemaArray),
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant