File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 11import type { Config , UserConfig } from '../types/config' ;
2+ import { isReadmeInput , transformReadmeInput } from '../utils/readme' ;
23
34const defaultWatch : Config [ 'input' ] [ 'watch' ] = {
45 enabled : false ,
@@ -38,7 +39,12 @@ export const getInput = (userConfig: UserConfig): Config['input'] => {
3839 } ;
3940
4041 if ( typeof userConfig . input === 'string' ) {
41- input . path = userConfig . input ;
42+ // Handle ReadMe input format transformation
43+ if ( isReadmeInput ( userConfig . input ) ) {
44+ input . path = transformReadmeInput ( userConfig . input ) ;
45+ } else {
46+ input . path = userConfig . input ;
47+ }
4248 } else if (
4349 userConfig . input &&
4450 ( userConfig . input . path !== undefined ||
@@ -51,6 +57,11 @@ export const getInput = (userConfig: UserConfig): Config['input'] => {
5157 ...userConfig . input ,
5258 } ;
5359
60+ // Handle ReadMe input format transformation when path is specified
61+ if ( typeof input . path === 'string' && isReadmeInput ( input . path ) ) {
62+ input . path = transformReadmeInput ( input . path ) ;
63+ }
64+
5465 // watch only remote files
5566 if ( input . watch !== undefined ) {
5667 input . watch = getWatch ( input ) ;
Original file line number Diff line number Diff line change @@ -18,14 +18,20 @@ export interface UserConfig {
1818 */
1919 dryRun ?: boolean ;
2020 /**
21- * Path to the OpenAPI specification. This can be either local or remote path.
21+ * Path to the OpenAPI specification. This can be either:
22+ * - local file
23+ *. - remote path
24+ * - ReadMe API Registry UUID (full and simplified formats)
25+ *
2226 * Both JSON and YAML file formats are supported. You can also pass the parsed
2327 * object directly if you're fetching the file yourself.
2428 *
2529 * Alternatively, you can define a configuration object with more options.
2630 */
2731 input :
28- | 'https://get.heyapi.dev/<organization>/<project>'
32+ | `https://get.heyapi.dev/${string } /${string } `
33+ | `readme:@${string } /${string } #${string } `
34+ | `readme:${string } `
2935 | ( string & { } )
3036 | ( Record < string , unknown > & { path ?: never } )
3137 | Input ;
Original file line number Diff line number Diff line change @@ -36,12 +36,18 @@ export type Input = {
3636 */
3737 organization ?: string ;
3838 /**
39- * Path to the OpenAPI specification. This can be either local or remote path.
39+ * Path to the OpenAPI specification. This can be either:
40+ * - local file
41+ *. - remote path
42+ * - ReadMe API Registry UUID (full and simplified formats)
43+ *
4044 * Both JSON and YAML file formats are supported. You can also pass the parsed
4145 * object directly if you're fetching the file yourself.
4246 */
4347 path ?:
44- | 'https://get.heyapi.dev/<organization>/<project>'
48+ | `https://get.heyapi.dev/${string } /${string } `
49+ | `readme:@${string } /${string } #${string } `
50+ | `readme:${string } `
4551 | ( string & { } )
4652 | Record < string , unknown > ;
4753 /**
You can’t perform that action at this time.
0 commit comments