-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): OpenApi v2 Parser Publishing (#5564)
* publishing working * chore: update changelog * slightly change language * chore: update changelog * kebab case subpackage titles for slug * kebab case subpackage name slugs * update comments --------- Co-authored-by: RohinBhargava <[email protected]> Co-authored-by: fern-support <[email protected]>
- Loading branch information
1 parent
e1dbac0
commit d53fcd8
Showing
5 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 0.47.0 | ||
**`(feat):`** The CLI now supports publishing docs using the improved OpenAPI v2 parser. You can set `openapi-parser-v2: true` | ||
in your `docs.yml` to use the new parser. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,7 +161,6 @@ export async function publishDocs({ | |
}, | ||
async ({ ir, snippetsConfig, playgroundConfig, apiName }) => { | ||
const apiDefinition = convertIrToFdrApi({ ir, snippetsConfig, playgroundConfig }); | ||
context.logger.debug("Calling registerAPI... ", JSON.stringify(apiDefinition, undefined, 4)); | ||
const response = await fdr.api.v1.register.registerApiDefinition({ | ||
orgId: CjsFdrSdk.OrgId(organization), | ||
apiId: CjsFdrSdk.ApiId(ir.apiName.originalName), | ||
|
@@ -182,9 +181,45 @@ export async function publishDocs({ | |
} | ||
default: | ||
if (apiName != null) { | ||
return context.failAndThrow(`Failed to register API ${apiName}`, response.error); | ||
return context.failAndThrow( | ||
`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact [email protected]\n ${response.error}` | ||
); | ||
} else { | ||
return context.failAndThrow("Failed to register API", response.error); | ||
return context.failAndThrow( | ||
`Failed to publish docs because API definition could not be uploaded. Please contact [email protected]\n ${response.error}` | ||
); | ||
} | ||
} | ||
} | ||
}, | ||
async ({ api, apiName }) => { | ||
const response = await fdr.api.v1.register.registerApiDefinition({ | ||
orgId: CjsFdrSdk.OrgId(organization), | ||
apiId: CjsFdrSdk.ApiId(apiName ?? api.id), | ||
definition: undefined, | ||
definitionV2: api | ||
}); | ||
|
||
if (response.ok) { | ||
context.logger.debug(`Registered API Definition ${response.body.apiDefinitionId}`); | ||
return response.body.apiDefinitionId; | ||
} else { | ||
switch (response.error.error) { | ||
case "UnauthorizedError": | ||
case "UserNotInOrgError": { | ||
return context.failAndThrow( | ||
"You do not have permissions to register the docs. Reach out to [email protected]" | ||
); | ||
} | ||
default: | ||
if (apiName != null) { | ||
return context.failAndThrow( | ||
`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact [email protected]\n ${response.error}` | ||
); | ||
} else { | ||
return context.failAndThrow( | ||
`Failed to publish docs because API definition could not be uploaded. Please contact [email protected]\n ${response.error}` | ||
); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters