main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
614 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import idFromPathMethod from './id-from-path-method/index.js';
|
---|
| 2 | import replaceSpecialCharsWithUnderscore from './replace-special-chars-with-underscore.js';
|
---|
| 3 | export default function opId(operation, pathName, method = '', {
|
---|
| 4 | v2OperationIdCompatibilityMode
|
---|
| 5 | } = {}) {
|
---|
| 6 | if (!operation || typeof operation !== 'object') {
|
---|
| 7 | return null;
|
---|
| 8 | }
|
---|
| 9 | const idWithoutWhitespace = (operation.operationId || '').replace(/\s/g, '');
|
---|
| 10 | if (idWithoutWhitespace.length) {
|
---|
| 11 | return replaceSpecialCharsWithUnderscore(operation.operationId);
|
---|
| 12 | }
|
---|
| 13 | return idFromPathMethod(pathName, method, {
|
---|
| 14 | v2OperationIdCompatibilityMode
|
---|
| 15 | });
|
---|
| 16 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.