Mermade / openapi-filter

Filter internal paths, operations, parameters, schemas etc from OpenAPI/Swagger/AsyncAPI definitions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: allow filtering individual fields in response

Foorack opened this issue · comments

Feature request to allow filtering individual fields in a response. The use case for this would be cases where the API either secretly or temporarily returns a specific field, which you need to specify in the spec due to API generation but doesn't want to document on the public docs.

I could possibly try make a PR, but wanted to post it as Issue to hear thoughts first.

Using the original mechanism for this tool (tagging an object with a flag extension such as x-internal), this is already possible. See

components:
responses:
ok:
description: OK
content:
'application/json':
schema:
type: object
properties:
public:
type: string
private:
type: string
x-internal: true
required:
- public

When you say "due to API generation", do you mean your OpenAPI definition is generated from code, and you can't introduce extension properties?

If so, how do you see specifying the property or properties to filter out? By having JSON-reference paths on the command-line, or some other method?

Okay, you're right. It seems like this feature is already implemented.
image

Thank you, closing this ticket. 👍

(And with "API generation", I meant that we generate SDK's from the OpenAPI specification.)