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

Nullable type doesn't work within method declaration #320

Closed
danilvalov opened this issue Apr 13, 2016 · 3 comments
Closed

Nullable type doesn't work within method declaration #320

danilvalov opened this issue Apr 13, 2016 · 3 comments

Comments

@danilvalov
Copy link

I'm trying to use nullable type in my mson following sample in the documentation, but it fails with semantic error.

Please help me to figure out what's wrong with my mson and how to make correct documentation for my use case?

Thanks!

@kylef
Copy link
Member

kylef commented Apr 13, 2016

Hi @danilvalov, Apiary isn't using the latest version of the API Blueprint Parser which adds support for nullability.

Apiary does have a beta for improve attributes rendering, which includes support for nullability. You can find more about the beta at #191 (comment) along with how to join it.

Regards,

Kyle

@kylef
Copy link
Member

kylef commented Jun 20, 2016

I just want to point out that this has now been deployed to Apiary (without a beta).

As an example, you can use nullable like the following:

+ Response 200 (application/json)
    + Attributes
        + example1 (string, optional, nullable) - An example optional nullable string
        + example2: value (string, optional, nullable) - An example optional nullable string with a sample value

Where this would result in an example payload of the following:

{
  "example1": null,
  "example2": "value"
}

Along with the following JSON schema:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "example1": {
      "type": [
        "string",
        "null"
      ],
      "description": "An example optional nullable string"
    },
    "example2": {
      "type": [
        "string",
        "null"
      ],
      "description": "An example optional nullable string with a sample value"
    }
  }
}

The table of attributes in Apiary doesn't yet mention that the value is nullable, but this is coming.

screen shot 2016-06-20 at 17 46 45

@patricksmms
Copy link

This is now visible, in ApiaryUI:
image

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

No branches or pull requests

3 participants