Git Product home page Git Product logo

bond-openapi-annotation-sample's Introduction

Bond / Swagger (OpenAPI) Attribute Sample

This sample shows a snippet of Bond IDL which expresses data annotations converted to a sample OpenAPI document. The OpenAPI document is then validated against both JSON Draft 4 schema and OpenAPI 2.0 schema.

The extension to JSON schema is based on section 5.6 of JSON Schema Draft 4

5.6. Extending JSON Schema Implementations MAY choose to define additional keywords to JSON Schema. Save for explicit agreement, schema authors SHALL NOT expect these additional keywords to be supported by peer implementations. Implementations SHOULD ignore keywords they do not support.

Bond IDL expressing a data annotation.

namespace Examples

struct QoSEventPartC
{
    [DataClass("EII")]
    10: required string UserEmailAddress;
    20: optional string UserPUID;
};

Swagger document specifying both an endpoint as well as `the data schema for QoSEventPartC. See the JSON schema excerpt below:

...
"definitions": {
        "QoSEventPartC": {
            "type": "object",
            "required": [
                "UserEmailAddress"
            ],
            "properties": {
                "UserEmailAddress": {
                    "type": "string",
                    "format": "email",
                    "x-ms-attributes": {
                        "Microsoft.Azure.DataClass": "EII"
                    }
                },
                "UserPUID": {
                    "type": "string"
                }
            }
        }
    }

Sample JSON document which represents the JSON schema above which corresponds to the Bond IDL

{
  "UserEmailAddress": "[email protected]",
  "UserPUID":  "foo"
}

bond-openapi-annotation-sample's People

Contributors

devigned avatar

Stargazers

Eduardo Salinas avatar

Watchers

James Cloos avatar  avatar

Forkers

chadwalters

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.