Skip to content

Commit

Permalink
chore: fix typing in analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
kanadgupta committed Sep 14, 2023
1 parent dd326bd commit fd1c619
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/lib/analyzeOas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,31 +169,30 @@ const README_FEATURE_DOCS: Record<keyof Analysis['readme'], Pick<AnalyzedFeature
*
*/
async function analyzeOas(definition: OASDocument) {
return analyzer(definition).then((analysis: Analysis) => {
return analyzer(definition).then(analysisResult => {
const analysis = analysisResult as Analysis;
if (analysis.openapi) {
Object.entries(OPENAPI_FEATURE_DOCS).forEach(([feature, docs]: [keyof Analysis['openapi'], AnalyzedFeature]) => {
// eslint-disable-next-line no-param-reassign
analysis.openapi[feature] = {
...analysis.openapi[feature],
Object.entries(OPENAPI_FEATURE_DOCS).forEach(([feature, docs]) => {
analysis.openapi[feature as keyof Analysis['openapi']] = {
...analysis.openapi[feature as keyof Analysis['openapi']],
...docs,
};
});
}

if (analysis.readme) {
Object.entries(README_FEATURE_DOCS).forEach(([feature, docs]: [keyof Analysis['readme'], AnalyzedFeature]) => {
Object.entries(README_FEATURE_DOCS).forEach(([feature, docs]) => {
// If this ReadMe feature isn't in our resulted analysis result then it's a deprecated
// feature that this API definition doesn't contain so we don't need to inform the user of
// something they neither use, can't use anyways, nor should know about.
if (!(feature in analysis.readme)) {
return;
}

// eslint-disable-next-line no-param-reassign
analysis.readme[feature] = {
...analysis.readme[feature],
analysis.readme[feature as keyof Analysis['readme']] = {
...analysis.readme[feature as keyof Analysis['readme']],
...docs,
};
} as AnalyzedFeature;
});
}

Expand Down

0 comments on commit fd1c619

Please sign in to comment.