inverseOperationIds removes schema properties named after HTTP methods (e.g. head)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
Research direction
Start at the openapiFilter logic for the “Inverse operationIds without operationIds” step and reproduce the issue with the supplied OpenAPI document. Check the traversal depth used for keys under paths, then verify that filtering createPull preserves the head, base, and get schema properties while still removing the targeted operation. વિસ્તાર
Written by the indexing model from the issue text.
Description
inverseOperationIds removes schema properties whose names are HTTP methods (head, get, post, …) when those properties are in inline schemas under paths, such as request bodies. The operation itself is kept, but it loses the properties.
This hit a real API: GitHub's "create a pull request" request body has a required head property, and inverseOperationIds: ['pulls/create'] strips it.
Reproduction (openapi-format 1.33.7, Node 24):
import { openapiFilter } from 'openapi-format';
const doc = {
openapi: '3.0.3',
info: { title: 't', version: '1' },
paths: {
'/pulls': {
post: {
operationId: 'createPull',
requestBody: {
content: {
'application/json': {
schema: {
type: 'object',
properties: {
head: { type: 'string' },
base: { type: 'string' },
get: { type: 'string' },
},
},
},
},
},
responses: { 201: { description: 'Created' } },
},
},
},
};
const { data } = await openapiFilter(doc, {
filterSet: { inverseOperationIds: ['createPull'] },
});
console.log(
Object.keys(data.paths['/pulls'].post.requestBody.content['application/json'].schema.properties),
);
Expected: [ 'head', 'base', 'get' ]
Actual: [ 'base' ]
With filterSet: {} or { unusedComponents: ['schemas'] }, all three properties are kept.
Likely cause: in openapiFilter, the "Inverse operationIds without operationIds" step removes any node under paths whose key is in httpVerbs and that has no operationId:
inverseFilterProps.length > 0 &&
this.path[0] === 'paths' &&
node.operationId === undefined &&
httpVerbs.includes(this.key)
It doesn't check depth, so it also matches schema properties inside operations. Restricting it to operation objects (for example this.path.length === 3, which is paths → path → method) should fix it.
- Dominant language
- JavaScript
- Stars
- 177
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from thim81/openapi-format
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
thim81/openapi-format#239 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
thim81/openapi-format#237 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
thim81/openapi-format#232 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
thim81/openapi-format#196 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
thim81/openapi-format#169 · 2 comments ·
All issues in thim81/openapi-format
Similar issues
-
Mend: dependency security vulnerability untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
opensearch-project/security-dashboards-plugin#2543 ·
Maintainers usually reply within 1 day
-
[quality] refresh-radar-reports.yml runs on ubuntu-latest while every other job pins ubuntu-24.04Openagent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
godotengine/godot-website#1432 ·
-
Add: Mooz RetroOpenchannels:add check:passed
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day