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

[oas/reducer] does not support circular path references #924

Open
erunion opened this issue Jan 23, 2025 · 0 comments
Open

[oas/reducer] does not support circular path references #924

erunion opened this issue Jan 23, 2025 · 0 comments

Comments

@erunion
Copy link
Member

erunion commented Jan 23, 2025

If you have an operation schema that somewhere deep inside contains a $ref to another operation then when you reduce that operation it won't carry along the referenced operation, resulting in a corrupted schema.

For example:

Image

Reducing GET /anything in this case will exclude POST /anything, resulting in a corrupted schema for GET /anything.

There is a broken and skipped test for this use case now in

/**
* @see RM-10597
*/
// eslint-disable-next-line vitest/no-disabled-tests
it.skip('should preserve required data in a circular definition', async () => {
const circular = new Oas(circularPathSchema as OASDocument);
await circular.dereference();
const reduced = reducer(circular.api as any, { paths: { '/anything': ['get'] } });
expect(Object.keys(reduced.paths['/anything'])).toStrictEqual(['get', 'post']);
});
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant