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

Proposal: ability to remove fields in data structures #420

Open
v1adko opened this issue Mar 7, 2018 · 0 comments
Open

Proposal: ability to remove fields in data structures #420

v1adko opened this issue Mar 7, 2018 · 0 comments

Comments

@v1adko
Copy link

v1adko commented Mar 7, 2018

I think it would be beneficial in terms of structure reusability if there was a way to remove keys from schemas (data structures).

I'm defining request/response objects like data structures

## Model-create-request (object)
<!-- include(./create.md) -->

## Model-create-response (object)
<!-- include(./create-response.md) -->

And in files I have something like this:

base.md

a: 1 (number, required) - One
b: 2 (number, required) - Two

create.md

<!-- include(./base.md) -->
c: 3 (number, required) - Three
d: 4 (number, required) - Four

create-response.md

<!-- include(./create.md) -->
extra: extra (string, required) - Something extra
-d

So now I would expect to have a response object like this:

{
   a: 1,
   b: 2,
   c: 3,
   extra: "Extra"
}

However I have found no way to remove an object key that was already defined somewhere "on top".
You can overwrite d to other value (null, undefined), but not remove it completely.

Currently -d results in

d: ""

Thank you for consideration.
BTW - great work, I really enjoy using this standard!

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