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

Inheritance and Member type precedence not working #366

Closed
jmatsushita opened this issue Jul 22, 2016 · 4 comments
Closed

Inheritance and Member type precedence not working #366

jmatsushita opened this issue Jul 22, 2016 · 4 comments
Labels

Comments

@jmatsushita
Copy link

I've seen a number of inheritance fixing pull requests and issues, but I'm not sure if I understand whether the MSON spec is supposed to be implemented in that regard.

In particular the member type precedence doesn't seem to work for me with protagonist@1.4.1 which if I understand correctly includes drafter@3.0.0.

Using the same example as in the spec (augmented with some descriptions):

# MyType

- person (Person)
    - `last_name` (optional) - Last name

# Person (object, fixed)
- `first_name` - First name
- `last_name` - override me
- address (object) - Address

Piped through refract.py gives:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "person": {
      "type": "object",
      "properties": {
        "first_name": {
          "type": "string",
          "description": "First name"
        },
        "last_name": {
          "type": "string",
          "description": "override me"
        },
        "address": {
          "type": "object",
          "properties": {},
          "additionalProperties": false,
          "description": "Address"
        }
      },
      "required": [
        "first_name",
        "last_name",
        "address"
      ],
      "additionalProperties": false
    }
  }
}

According to the doc, last_name shouldn't be required no? In addition shouldn't the description of last_name be "Last name"?

@jmatsushita
Copy link
Author

Hi @pksunkara, is that a bug or did I miss something?

@pksunkara
Copy link
Contributor

@jmatsushita Thanks for the report. This is definitely a bug.

@pksunkara pksunkara added the bug label Jul 25, 2016
@jmatsushita
Copy link
Author

Hi @pksunkara, have you been able to reproduce and maybe look into this?

@kylef
Copy link
Member

kylef commented Aug 13, 2016

@jmatsushita Yes, we've confirmed this bug. It's on our agenda to fix and it's one of the next up bugs which we will hopefully tackle in the next two weeks.

When we're expanding and rendering the JSON Schema for an MSON property in Drafter, we're not taking into account some of the overridden attributes (description, type, etc) which we will need to fix. Thanks for reporting.

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

No branches or pull requests

3 participants