oxidecomputer / oxidecomputer/typify

Failing schema: unhandled array validation

Open
#269 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
898
Forks
114
Avg merge
4h 18m
Merged PRs (30d)
14

Description

The schema is here: https://github.com/jgm/djot.js/blob/baa4d3e62bccaebe0680adea1b185adbd211fd8a/djot-schema.json , and is AFAIK automatically generated using typescript-json-schema.

The output of cargo typify is

cargo typify --output src/types.rs djot.js/djot-schema.json
Error: 
   0: Failed to convert JSON Schema to Rust code
   1: Could not add ref types from the 'definitions' field in the JSON Schema
   2: schema invalid: unhandled array validation ArrayValidation {
          items: Some(
              Vec(
                  [
                      Object(
                          SchemaObject {
                              metadata: None,
                              instance_type: None,
                              format: None,
                              enum_values: None,
                              const_value: None,
                              subschemas: None,
                              number: None,
                              string: None,
                              array: None,
                              object: None,
                              reference: Some(
                                  "#/definitions/Caption",
                              ),
                              extensions: {},
                          },
                      ),
                  ],
              ),
          ),
          additional_items: Some(
              Object(
                  SchemaObject {
                      metadata: None,
                      instance_type: None,
                      format: None,
                      enum_values: None,
                      const_value: None,
                      subschemas: None,
                      number: None,
                      string: None,
                      array: None,
                      object: None,
                      reference: Some(
                          "#/definitions/Row",
                      ),
                      extensions: {},
                  },
              ),
          ),
          max_items: None,
          min_items: Some(
              1,
          ),
          unique_items: None,
          contains: None,
      }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with cargo typify --output src/types.rs djot.js/djot-schema.json using the referenced djot-schema.json. Start by tracing handling of the array validation shown in the error, and consider the work complete when the schema converts successfully into src/types.rs without the unhandled array validation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.