Closed sekaranglila closed 1 month ago
hi @sekaranglila
I would have to investigate if it is possible.
hi @sekaranglila
could you share an example of what would be the input and expected output?
Hi @thim81 , sorry for the late reply. For example, I'd like to keep certain objects that aren't used in the remaining APIs (e.g. Callback Objects). However, there's no way to persist them without inverse flags. I could keep them if I could add flags like x-callback-object: false
to all the other objects, but in a large file that would be too much toil, so instead an inverse flag is much more preffered.
@thim81 We have the same need, inverseFlagValue would be even more helpful.
We have the following use case:
We want to split our big API file into smaller API specs based on different API use cases. So we've added
paths:
/api/resource/subscription:
get:
parameters: []
responses:
'200':
description: asd
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Example'
deprecated: false
tags:
- Actor
x-custom-api-name: payment-api
/api/resource/user:
get:
parameters: []
responses:
'200':
description: asd
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Example'
deprecated: false
tags:
- Actor
x-custom-api-name: management-api
We want to filter the paths based on the x-custom-api-name
and keep the references that are linked inside the paths.
@stvnwrgs to double-check, you want to keep all the flags with a value that match
Example:
inverseFlagValues:
- x-custom-api-name: management-api
Should keep only the management-api flagged items like the /api/resource/user
operation?
@stvnwrgs @sekaranglila
I just created a PR to introduce the inverseFlagValue
option.
It is a very aggresive filter, since it will only keep the elements where the flag with the value is present.
For now, it focusses on inverse filtering for flagValues for operations, components, tags, x-tagGroups. The elements like info, servers remain untouched by the inverseFlagValue filtering.
The PR will bring the support for inverseFlags
and inverseFlagValues
option.
@stvnwrgs @sekaranglila
If you have 5 min could review the provided examples (input->output) are behaving as expected for the inverseFlags & inverseFlagValues.
https://github.com/thim81/openapi-format/tree/79-inverse-flagvalues/test/yaml-filter-inverse-flags https://github.com/thim81/openapi-format/tree/79-inverse-flagvalues/test/yaml-filter-inverse-flags-flagsValues
It removes all items in operations, components, tags, x-tagGroups that don't have the flags present.
hi @stvnwrgs and @sekaranglila
Could you have a look at the PR with the inverseFlags & inverseFlagValues.
https://github.com/thim81/openapi-format/tree/79-inverse-flagvalues/test/yaml-filter-inverse-flags https://github.com/thim81/openapi-format/tree/79-inverse-flagvalues/test/yaml-filter-inverse-flags-flagsValues
Would this solve your use-cases?
Hey @thim81, yes this is exactly what I would need. Thank you for the quick implementation!
hi @stvnwrgs and @sekaranglila
openapi-format 1.17.0 is just released, which includes the new features for inverse flag & flagValues filtering
Hi, I was wondering if we can implement inverse flags as well? Thank you