source: node_modules/@swagger-api/apidom-ns-json-schema-draft-4/es/elements/JSONReference.mjs

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 840 bytes
Line 
1import { ObjectElement } from '@swagger-api/apidom-core';
2
3/**
4 * In Draft 4, $ref behaves a little differently. When an object contains a $ref property,
5 * the object is considered a reference, not a schema. Therefore, any other properties you put in that object will
6 * not be treated as JSON Schema keywords and will be ignored by the validator.
7 * $ref can only be used where a schema is expected.
8 *
9 * URI: https://json-schema.org/understanding-json-schema/structuring.html?highlight=ref#id18
10 */
11
12class JSONReference extends ObjectElement {
13 constructor(content, meta, attributes) {
14 super(content, meta, attributes);
15 this.element = 'JSONReference';
16 this.classes.push('json-reference');
17 }
18 get $ref() {
19 return this.get('$ref');
20 }
21 set $ref($ref) {
22 this.set('$ref', $ref);
23 }
24}
25export default JSONReference;
Note: See TracBrowser for help on using the repository browser.