1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package dev.metaschema.schemagen.json.impl;
7   
8   import java.util.List;
9   
10  import dev.metaschema.core.model.IFlagInstance;
11  import dev.metaschema.core.qname.IEnhancedQName;
12  import edu.umd.cs.findbugs.annotations.NonNull;
13  import edu.umd.cs.findbugs.annotations.Nullable;
14  
15  /**
16   * Supports generation of a JSON schema based on a Metaschema model definition,
17   * which can be generated inline or as a JSON schema definition.
18   */
19  public interface IJsonSchemaModelDefinition extends IJsonSchemaDefinition {
20    /**
21     * Get the name of the JSON key flag.
22     *
23     * @return the name or {@code null} if a JSON property key is not used
24     */
25    @Nullable
26    default IEnhancedQName getJsonKeyFlagName() {
27      IFlagInstance jsonKey = getJsonKeyFlag();
28      return jsonKey == null ? null : jsonKey.getQName();
29    }
30  
31    /**
32     * Get the JSON key flag.
33     *
34     * @return the flag or {@code null} if a JSON property key is not used
35     */
36    @Nullable
37    IFlagInstance getJsonKeyFlag();
38  
39    /**
40     * Get the list of flags to use as properties.
41     * <p>
42     * This list will not include the JSON key flag.
43     *
44     * @return the list of flag JSON schema properties
45     */
46    @NonNull
47    List<IJsonSchemaPropertyFlag> getFlagProperties();
48  }