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

Support for optional response elements in schema #53

Closed
bensleveritt opened this issue Feb 3, 2014 · 3 comments
Closed

Support for optional response elements in schema #53

bensleveritt opened this issue Feb 3, 2014 · 3 comments

Comments

@bensleveritt
Copy link

Does 1A support required/optional flags in schema specifications?
My specification is:

## Entities [/api/entities]
+ Model

    + Body

        ```
        {
            "entities": [
                {
                    "id": "entity1",
                    "name": "Entity"
                }
            ],
            "total": 1
        }
        ```

    + Schema

        ```
        {
            "title": "Entities Schema",
            "type": "object",
            "properties": {
                "entities": {
                    "type": "array",
                    "items": {
                        "required": ["id"]
                    }
                },
                "total": {
                    "type": "integer"
                }
            }
        }
        ```

Trying to validate this response with Dredd, and it says that name is required and is missing. I've validated the schema against http://json-schema-validator.herokuapp.com/ and it's all clear, leading me to suspect that it's how I've written the schema.

Thanks in advance.

@zdne zdne added the question label Feb 4, 2014
@zdne
Copy link
Contributor

zdne commented Feb 4, 2014

@bensleveritt

API Blueprint and its parser treats all assets as opaque blocks. That is, it does not inspect or interpret anything that is inside a message-body or message-body validation schema. It is up to the tool how it handles the schema. In this case the actual behavior is driven by the Dredd implementation or more precisely Gavel.js – the tool Dredd uses to validate HTTP requests.

Please check the Gavel.js and its Issues.

@bensleveritt
Copy link
Author

Thanks for clarifying that. Wasn't sure what handled by which bit. I'll raise it with Gavel.

@zdne
Copy link
Contributor

zdne commented Feb 4, 2014

@bensleveritt

No problem. The important premise here is that API Blueprint does not step into assets what so ever. As tempting as it might be I want to draw a thick line here.

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

2 participants