Skip to content

Commit a438729

Browse files
authored
fix(repository-json-schema): fix $ref typo (#963)
* fix(repository-json-schema): fix $ref typo * fix(repository-json-schema): fix README
1 parent a2368ce commit a438729

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

packages/openapi-v2/test/unit/controller-spec/controller-decorators/param-decorators/param.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ describe('Routing metadata for parameters', () => {
325325
type: 'string',
326326
},
327327
foo: {
328-
$ref: '#definitions/Foo',
328+
$ref: '#/definitions/Foo',
329329
},
330330
},
331331
});

packages/repository-json-schema/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ The value of `jsonSchema` will be:
3030

3131
```json
3232
{
33+
"title": "MyModel",
3334
"properties": {
3435
"name": {
3536
"type": "string"

packages/repository-json-schema/src/build-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function metaToJsonProperty(meta: PropertyDefinition): JsonDefinition {
101101
}
102102

103103
const propDef = isComplexType(ctor)
104-
? {$ref: `#definitions/${ctor.name}`}
104+
? {$ref: `#/definitions/${ctor.name}`}
105105
: {type: ctor.name.toLowerCase()};
106106

107107
if (meta.array) {

packages/repository-json-schema/test/integration/build-schema.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('build-schema', () => {
139139
const jsonSchema = modelToJsonSchema(TestModel);
140140
expect(jsonSchema.properties).to.deepEqual({
141141
cusType: {
142-
$ref: '#definitions/CustomType',
142+
$ref: '#/definitions/CustomType',
143143
},
144144
});
145145
expect(jsonSchema).to.not.have.key('definitions');
@@ -159,7 +159,7 @@ describe('build-schema', () => {
159159
const jsonSchema = modelToJsonSchema(TestModel);
160160
expect(jsonSchema.properties).to.deepEqual({
161161
cusType: {
162-
$ref: '#definitions/CustomType',
162+
$ref: '#/definitions/CustomType',
163163
},
164164
});
165165
expect(jsonSchema.definitions).to.deepEqual({
@@ -195,7 +195,7 @@ describe('build-schema', () => {
195195
const schemaDefs = jsonSchema.definitions;
196196
expect(schemaProps).to.deepEqual({
197197
cusBar: {
198-
$ref: '#definitions/CustomTypeBar',
198+
$ref: '#/definitions/CustomTypeBar',
199199
},
200200
});
201201
expect(schemaDefs).to.deepEqual({
@@ -213,7 +213,7 @@ describe('build-schema', () => {
213213
prop: {
214214
type: 'array',
215215
items: {
216-
$ref: '#definitions/CustomTypeFoo',
216+
$ref: '#/definitions/CustomTypeFoo',
217217
},
218218
},
219219
},
@@ -254,7 +254,7 @@ describe('build-schema', () => {
254254
cusArr: {
255255
type: 'array',
256256
items: {
257-
$ref: '#definitions/CustomType',
257+
$ref: '#/definitions/CustomType',
258258
},
259259
},
260260
});

packages/repository-json-schema/test/unit/build-schema.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('build-schema', () => {
6363
it('converts complex types', () => {
6464
class CustomType {}
6565
expect(metaToJsonProperty({type: CustomType})).to.eql({
66-
$ref: '#definitions/CustomType',
66+
$ref: '#/definitions/CustomType',
6767
});
6868
});
6969

@@ -78,7 +78,7 @@ describe('build-schema', () => {
7878
class CustomType {}
7979
expect(metaToJsonProperty({array: true, type: CustomType})).to.eql({
8080
type: 'array',
81-
items: {$ref: '#definitions/CustomType'},
81+
items: {$ref: '#/definitions/CustomType'},
8282
});
8383
});
8484
});

0 commit comments

Comments
 (0)