apiblueprintapiary.iomson

Omit property of object defined in MSON


How can I ommit property from defined MSON? I have defined one simple entity (object) using MSON:

# Data Structures

## Article (object)
Represents an article

## Properties
+ id: 1 (number, optional)
+ name: My first article (string)

## Articles [/articles]

### Get all articles [GET]

Get all articles available on this website.

+ Response 200 (application/json)
 + Attributes (array[Article])

### Create an article [POST]

Create new article.

+ Request (application/json)
    + Attributes (Article)

I'm using Article object in several api endpoints. The problem is that I don't want id to be specified when posting new article so I want to omit it in the documentation for POST method. Is it possible to include Article entity in all endpoints and say what fields I want to omit?


Solution

  • There is no actually way how to do it. You have two options:

    # Data Structures
    
    ## Article (object)
    + name: My first article (string)
    
    ## ArticleInstance (Article)
    + id (number)
    
    ## Articles [/articles]
    
    ### Get all articles [GET]
    
    Get all articles available on this website.
    
    + Response 200 (application/json)
     + Attributes (array[Article])
    
    ### Create an article [POST]
    
    Create new article.
    
    + Request (application/json)
        + Attributes (Article)