Skip to content

JSF Library Failing on JSON Schemas - Need Advice #124

@Miskler

Description

@Miskler

What's happening?

I'm trying to use JSF (JSON Schema Faker) to generate test data from our API snapshots, but getting 'NoneType' object has no attribute 'name' errors on 13 schema files.

The schemas were generated using genson from actual API responses.

Example Schema

{
  "$schema": "http://json-schema.org/schema#",
  "type": "object",
  "properties": {
    "content": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array"
        }
      },
      "required": ["items"]
    }
  },
  "required": ["content"]
}

What I think is happening:

JSF seems to expect arrays to have an items definition:

"items": {
  "type": "array",
  "items": { "type": "string" }  // This is missing
}

But our genson-generated schemas just have:

"items": {
  "type": "array"  // No items definition
}

Is this understanding correct? Should arrays always have items defined for JSF to work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions