Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

inverseOperationIds removes schema properties named after HTTP methods (e.g. head)

Open Beginner friendly
#238 1 comment 0 reactions 1 assignee View on GitHub

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
Domain
api, tooling

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

bug

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from thim81/openapi-format

All issues in thim81/openapi-format

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.