Skip to content

Commit

Permalink
fix: create crud options control
Browse files Browse the repository at this point in the history
  • Loading branch information
fernando.cano authored and jorgecasar committed Jan 18, 2024
1 parent 4a1f456 commit 4984ff9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/const/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
export const EMPTY_TAG = undefined;
export const OPEN_API_OPERATIONS = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'];
14 changes: 10 additions & 4 deletions src/helpers/documentParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { resolveSchemaName, parseTypes } from '.';
import { OPEN_API_OPERATIONS } from '../const';
import { DataObject, Path } from '../types';

export function parseDocument(data: DataObject) {
Expand Down Expand Up @@ -173,10 +174,15 @@ function formatPath(path: string): string {
}

function parseMethods(methods: DataObject) {
return Object.keys(methods).map((method: string) => ({
methodName: method,
...methods[method],
}));
const parsedMethods = Object.keys(methods).map((method: string) => {
if (OPEN_API_OPERATIONS.includes(method)) {
return {
methodName: method,
...methods[method],
};
}
});
return parsedMethods.filter((method) => method !== undefined);
}

function parseResponses(responses: DataObject) {
Expand Down

0 comments on commit 4984ff9

Please # to comment.