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

oneOf in schema.json is showing null in generated documentaion #321

Open
sammyApe opened this issue Jan 26, 2017 · 5 comments
Open

oneOf in schema.json is showing null in generated documentaion #321

sammyApe opened this issue Jan 26, 2017 · 5 comments

Comments

@sammyApe
Copy link

No description provided.

@sammyApe sammyApe changed the title Is there a way I can edit the source code to allow showing oneOf in the documentation.It is appearing as null in the generated doc but I really need to have this functionality oneOf in schema.json is showing null in generated documentaion Jan 26, 2017
@geemus
Copy link
Member

geemus commented Jan 26, 2017

You could probably do this via custom templates for the docs, but I'm not sure I totally know what you want. Could you provide a small-ish sample schema that demonstrates what you mean?

@sammyApe
Copy link
Author

sammyApe commented Jan 26, 2017

so with a schema.json like the one below, If I execute the doc command i get null for a but b comes as expected

{
  "$schema": "http://interagent.github.io/interagent-hyper-schema",
  "type": [
    "object"
  ],
  "definitions": {
    "a": {
      "title": "a",
      "description": "",
      "type": [
        "object"
      ],
      "oneOf": [
        {
          "properties": {
            "c": {
              "type":"object",
              "description":"c element"
            }
          },
          "additionalProperties": false
        },
        {
          "properties": {
            "d": {
              "type":"object",
              "description":"d element"

            }
          },
          "additionalProperties": false
        }
      ],
      "definitions":{
        "identity": {
        }
      },
      "links":[]

    },
    "b":{
      "title": "a",
      "type":"string",
      "description": "b element",
      "definitions":{
        "identity": {
        }
      },
      "links":[]
    }

  },
  "properties": {
    "a": {
      "$ref": "#/definitions/a"
    },
    "b": {
      "$ref": "#/definitions/b"
    }
  },
  "links": [
    {
      "href": "https://xxx.com",
      "rel": "self"
    }
  ],
  "id": "xxx",
  "description":"xxx element",
  "title": "",
  "additionalProperties": false
}

@geemus
Copy link
Member

geemus commented Jan 31, 2017

Ah. I wonder if you might have better luck if you reversed the nesting. So a would have the oneOf inside the properties attribute (instead of having the properties attributes repeated inside). Worth a shot anyway.

@sammyApe
Copy link
Author

I tried that way but it only works when c and d enums .. I had to tweak the schemata.md.erb file to make it work for me. Thanks

@geemus
Copy link
Member

geemus commented Feb 6, 2017

@sammyApe thanks for the update, glad to hear you found a workaround. Hopefully we can get this fixed/improved in the future so that wouldn't be needed.

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

No branches or pull requests

2 participants