1 /*
2 * SPDX-FileCopyrightText: none
3 * SPDX-License-Identifier: CC0-1.0
4 */
5
6 package gov.nist.secauto.metaschema.schemagen.json.impl;
7
8 import com.fasterxml.jackson.databind.node.ObjectNode;
9
10 import java.util.Set;
11 import java.util.stream.Stream;
12
13 import edu.umd.cs.findbugs.annotations.NonNull;
14
15 /**
16 * A JSON schema property construction for a given Metaschema instance, which is
17 * part of a larger JSON schema.
18 */
19 public interface IJsonSchemaProperty {
20 /**
21 * Used to recursively collect definitions that are used within the model graph
22 * for descendants of this node.
23 *
24 * @param visited
25 * the ancestor assembly definitions that have been visited
26 * @param state
27 * the generation state used to generate this JSON schema
28 * @return a stream of JSON schema definition object referenced within
29 * descendants within this node's graph
30 */
31 @NonNull
32 Stream<IJsonSchemaDefinable> collectDefinitions(
33 @NonNull Set<IJsonSchemaDefinitionAssembly> visited,
34 @NonNull IJsonGenerationState state);
35
36 /**
37 * Generate the property contents.
38 *
39 * @param node
40 * the property JSON object
41 * @param state
42 * the schema generation state used for context
43 */
44 void generate(@NonNull ObjectNode node, @NonNull IJsonGenerationState state);
45 }