Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Schemas with Definitions not generated correctly without -x flag #30

@sethfri

Description

@sethfri

Take the following schema example:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Example",
  "additionalProperties": false,

  "properties": {
    "foo":          { "type": "string" },
    "bar":          { "$ref": "#/definitions/baz" }
  },

  "definitions": {
    "baz": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "header": {
          "description": "This is the header",
          "type": "string"
        },
        "message": {
          "description": "This is the message",
          "type": "string"
        },
      }
    }
  }
}

Run $ nidyx test.json.schema - o test --json-model or $ nidyx test.json.schema TST -o test --json-model to use a prefix as the README describes. This generates Model.{h,m}. Model.h looks like:

@interface Model : JSONModel

@property (strong, nonatomic) NSString<Optional> *foo;
@property (strong, nonatomic) Model<Optional> *bar;

@end

Model.m is a blank implementation. TSTBazModel is not generated at all. If you run $ nidyx test.json.schema -x TST -o test --json-model, everything works as expected

Fix: The -x flag should be a) documented in the README and b) marked as required or made optional

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