Skip to content

Commit 26d9947

Browse files
committed
Closes #79 Fix dereference of alias schemas
1 parent fffa059 commit 26d9947

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

lib/src/generators/schema.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ class SchemaGenerator extends BaseGenerator {
160160
enumeration: (schema) {
161161
_writeEnumeration(name: name, schema: schema);
162162
},
163+
string: (value) {
164+
_writeTypedef(
165+
name: name,
166+
description: value.description,
167+
def: 'String',
168+
);
169+
},
163170
array: (schema) {
164171
final iType = schema.items.toDartType();
165172
_writeTypedef(

test/misc/misc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,30 @@
3131
}
3232
},
3333
"components": {
34+
"securitySchemes": {
35+
"HTTPBearer": {
36+
"type": "http",
37+
"scheme": "bearer"
38+
}
39+
},
3440
"schemas": {
3541
"MapResult": {
3642
"properties": {},
3743
"additionalProperties": true,
3844
"type": "object",
3945
"title": "MapResult",
4046
"description": "A MapResult"
47+
},
48+
"StringAlias": {
49+
"type": "string"
50+
},
51+
"MyObject": {
52+
"type": "object",
53+
"properties": {
54+
"myField": {
55+
"$ref": "#/components/schemas/StringAlias"
56+
}
57+
}
4158
}
4259
}
4360
}

0 commit comments

Comments
 (0)