Skip to content
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

fix: 兼容调用resolveObject函数,schemaObject为null导致报错的场景 #141

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/serviceGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { existsSync, readFileSync } from 'fs';
import glob from 'glob';
import { camelCase } from 'lodash';
import * as nunjucks from 'nunjucks';
import type {
ContentObject,
Expand All @@ -14,7 +15,6 @@ import type {
SchemaObject,
} from 'openapi3-ts';
import { join } from 'path';
import { camelCase } from 'lodash';
import ReservedDict from 'reserved-words';
import rimraf from 'rimraf';
import pinyin from 'tiny-pinyin';
Expand Down Expand Up @@ -925,6 +925,7 @@ class ServiceGenerator {
}

resolveObject(schemaObject: SchemaObject) {
schemaObject = schemaObject ?? {};
// 引用类型
if (schemaObject.$ref) {
return this.resolveRefObject(schemaObject);
Expand Down