summaryrefslogtreecommitdiff
path: root/src/main/java/com/networknt/schema/Version6.java
blob: 3b308227d0a785583b32e9b92f5d573a63410144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.networknt.schema;

import java.util.Arrays;

/**
 * Draft 6 dialect.
 */
public class Version6 implements JsonSchemaVersion {
    private static final String IRI = SchemaId.V6;
    // Draft 6 uses "$id"
    private static final String ID = "$id";

    private static class Holder {
        private static final JsonMetaSchema INSTANCE;
        static {
            INSTANCE = JsonMetaSchema.builder(IRI)
                    .specification(SpecVersion.VersionFlag.V6)
                    .idKeyword(ID)
                    .formats(Formats.DEFAULT)
                    .keywords(ValidatorTypeCode.getKeywords(SpecVersion.VersionFlag.V6))
                    // keywords that may validly exist, but have no validation aspect to them
                    .keywords(Arrays.asList(
                            new NonValidationKeyword("$schema"),
                            new NonValidationKeyword("$id"),
                            new AnnotationKeyword("title"),
                            new AnnotationKeyword("description"),
                            new AnnotationKeyword("default"),
                            new NonValidationKeyword("additionalItems"),
                            new NonValidationKeyword("definitions"),
                            new AnnotationKeyword("examples")
                    ))
                    .build();
        }
    }

    public JsonMetaSchema getInstance() {
        return Holder.INSTANCE;
    }
}