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?
There is no actually way how to do it. You have two options:
declare id
with attribute nullable
Declare Article
without id
and later inherit from Article
and attach id
.
# 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)