-
Notifications
You must be signed in to change notification settings - Fork 43
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
docs(openapi): add postman warning #851
base: next
Are you sure you want to change the base?
Changes from all commits
9969841
bfc407d
e2ed8b7
9ff76ba
b615880
489775f
a5493b3
06ddafa
318b230
f09c076
c1c20d9
bee66b8
ca069d7
1490d18
7d9d283
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import OASNormalize, { getAPIDefinitionType } from 'oas-normalize'; | |
import ora from 'ora'; | ||
|
||
import isCI from './isCI.js'; | ||
import { debug, info, oraOptions } from './logger.js'; | ||
import { debug, info, warn, oraOptions } from './logger.js'; | ||
import promptTerminal from './promptWrapper.js'; | ||
import readdirRecursive from './readdirRecursive.js'; | ||
|
||
|
@@ -211,6 +211,34 @@ export default async function prepareOas( | |
debug('spec bundled'); | ||
} | ||
|
||
// Checks to see if the selected file is a postman collection and throws a warning in the console depending on the command. | ||
if (definitionVersion.specification === 'postman') { | ||
switch (command) { | ||
case 'openapi': | ||
Comment on lines
+215
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great job here with this |
||
warn( | ||
'You are attempting to upload a Postman collection. This feature is currently experimental. For more information, visit our docs here: https://docs.readme.com/main/docs/openapi#the-api-reference', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. small refactoring suggestion: mind creating a separate variable above (called |
||
); | ||
break; | ||
case 'openapi:validate': | ||
warn( | ||
'You are attempting to validate a Postman collection. This feature is currently experimental. For more information, visit our docs here: https://docs.readme.com/main/docs/openapi#the-api-reference', | ||
); | ||
break; | ||
case 'openapi:inspect': | ||
warn( | ||
'You are inspecting a Postman collection. This feature is currently experimental. For more information, visit our docs here: https://docs.readme.com/main/docs/openapi#the-api-reference', | ||
); | ||
break; | ||
case 'openapi:convert': | ||
warn( | ||
'You are attempting to convert a Postman collection to an OpenAPI file. This feature is currently experimental. For more information, visit our docs here: https://docs.readme.com/main/docs/openapi#the-api-reference', | ||
); | ||
break; | ||
default: | ||
debug(`Type ${chalk.yellow('rdme help')} to see all commands`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't think you need this |
||
} | ||
} | ||
|
||
return { | ||
preparedSpec: JSON.stringify(api), | ||
/** A string indicating whether the spec file is a local path, a URL, etc. */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind reverting this change?