Skip to content

Commit 4984ff9

Browse files
fernando.canojorgecasar
authored andcommitted
fix: create crud options control
1 parent 4a1f456 commit 4984ff9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/const/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
66
export const EMPTY_TAG = undefined;
7+
export const OPEN_API_OPERATIONS = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'];

src/helpers/documentParser.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
66
import { resolveSchemaName, parseTypes } from '.';
7+
import { OPEN_API_OPERATIONS } from '../const';
78
import { DataObject, Path } from '../types';
89

910
export function parseDocument(data: DataObject) {
@@ -173,10 +174,15 @@ function formatPath(path: string): string {
173174
}
174175

175176
function parseMethods(methods: DataObject) {
176-
return Object.keys(methods).map((method: string) => ({
177-
methodName: method,
178-
...methods[method],
179-
}));
177+
const parsedMethods = Object.keys(methods).map((method: string) => {
178+
if (OPEN_API_OPERATIONS.includes(method)) {
179+
return {
180+
methodName: method,
181+
...methods[method],
182+
};
183+
}
184+
});
185+
return parsedMethods.filter((method) => method !== undefined);
180186
}
181187

182188
function parseResponses(responses: DataObject) {

0 commit comments

Comments
 (0)