MCPcopy Create free account
hub / github.com/fabien0102/openapi-codegen / askForUrl

Method askForUrl

cli/src/commands/InitCommand.ts:127–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125 }
126
127 private async askForUrl(): Promise<UrlOptions> {
128 return {
129 source: "url",
130 url: await prompt
131 .text({
132 message: "Url",
133 placeholder: "https://.../openapi.json",
134 validate(value) {
135 if (!value.startsWith("https://") && !value.startsWith("http://")) {
136 return "Url must starts with http or https protocol";
137 }
138 if (
139 !value.endsWith(".json") &&
140 !value.endsWith(".yaml") &&
141 !value.endsWith(".yml")
142 ) {
143 return "Url must ends with `.json` or `.yaml` or `.yml`";
144 }
145 },
146 })
147 .then(handlePromptCancel),
148 };
149 }
150
151 async execute() {
152 const userConfigPath = path.join(

Callers 1

executeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected