From 7d00193ce69e25cff894c55430f8e016687830fa Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Mon, 1 Jul 2024 19:24:48 +0530 Subject: [PATCH] fix refs Signed-off-by: MUzairS15 --- schemas/constructs/openapi/models.yml | 9 +++++ schemas/constructs/v1alpha2/core.json | 2 +- schemas/constructs/v1alpha2/relationship.json | 24 ++++++------ schemas/constructs/v1alpha2/selectors.json | 8 ++-- schemas/constructs/v1beta1/component.json | 8 ++-- schemas/constructs/v1beta1/model.json | 39 ++++++++++++------- scripts/merge-openapi-specs.sh | 2 +- 7 files changed, 56 insertions(+), 36 deletions(-) create mode 100644 schemas/constructs/openapi/models.yml diff --git a/schemas/constructs/openapi/models.yml b/schemas/constructs/openapi/models.yml new file mode 100644 index 0000000000..0c3080de4b --- /dev/null +++ b/schemas/constructs/openapi/models.yml @@ -0,0 +1,9 @@ +openapi: 3.0.0 +components: + schemas: + models: + $ref: ../v1beta1/model.json + components: + $ref: ../v1beta1/component.json + relationships: + $ref: ../v1alpha2/relationship.json \ No newline at end of file diff --git a/schemas/constructs/v1alpha2/core.json b/schemas/constructs/v1alpha2/core.json index 1c5fb154cf..2c9b2b1d8e 100644 --- a/schemas/constructs/v1alpha2/core.json +++ b/schemas/constructs/v1alpha2/core.json @@ -13,7 +13,7 @@ "maxLength": 100, "description": "API version of the object", "pattern": "([a-z.])*(?!^\/)v(alpha|beta|[0-9]+)([.-]*[a-z0-9]+)*$", - "examples": [ + "example": [ "v1", "v1alpha1", "v2beta3", diff --git a/schemas/constructs/v1alpha2/relationship.json b/schemas/constructs/v1alpha2/relationship.json index f2d7b859d5..64e5db825e 100644 --- a/schemas/constructs/v1alpha2/relationship.json +++ b/schemas/constructs/v1alpha2/relationship.json @@ -15,15 +15,15 @@ "type": "object", "properties": { "schemaVersion": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#versionString", + "$ref": "./core.json#/definitions/versionString", "description": "Specifies the version of the schema used for the definition." }, "version": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#semverString", + "$ref": "./core.json#/definitions/semverString", "description": "Specifies the version of the definition." }, "kind": { - "$ref": "https://schemas.meshery.io/core.json#inputString", + "$ref": "./core.json#/definitions/inputString", "description": "Kind of the Relationship.", "enum": [ "hierarchical", @@ -32,15 +32,15 @@ ] }, "type": { - "$ref": "https://schemas.meshery.io/core.json#inputString", + "$ref": "./core.json#/definitions/inputString", "description": "Classification of relationships. Used to group relationships similar in nature." }, "subType": { - "$ref": "https://schemas.meshery.io/core.json#inputString", + "$ref": "./core.json#/definitions/inputString", "description": "Used for further classification of Relationships. Type and SubType together identifies a Relationship." }, "evaluationQuery": { - "$ref": "https://schemas.meshery.io/core.json#inputString", + "$ref": "./core.json#/definitions/inputString", "description": "Determines the policy rule to be used for the evaluation of the relationship." }, "metadata": { @@ -48,13 +48,13 @@ "description": "Metadata contains additional information associated with the Relationship.", "properties": { "description": { - "$ref": "https://schemas.meshery.io/core.json#inputString", + "$ref": "./core.json#/definitions/inputString", "description": "Description of the Relationship." } } }, "model": { - "$ref": "https://schemas.meshery.io/v1alpha1/model.json", + "$ref": "../v1beta1/model.json", "description": "Model of the Relationship." }, "selectors": { @@ -78,10 +78,10 @@ ], "properties": { "from": { - "$ref": "https://schemas.meshery.io/v1alpha2/selectors.json#from" + "$ref": "./selectors.json#/from" }, "to": { - "$ref": "https://schemas.meshery.io/v1alpha2/selectors.json#to" + "$ref": "./selectors.json#/to" } } }, @@ -94,10 +94,10 @@ ], "properties": { "from": { - "$ref": "https://schemas.meshery.io/v1alpha2/selectors.json#from" + "$ref": "./selectors.json#/from" }, "to": { - "$ref": "https://schemas.meshery.io/v1alpha2/selectors.json#to" + "$ref": "./selectors.json#/to" } } } diff --git a/schemas/constructs/v1alpha2/selectors.json b/schemas/constructs/v1alpha2/selectors.json index c152d765f8..0d7c959ba6 100644 --- a/schemas/constructs/v1alpha2/selectors.json +++ b/schemas/constructs/v1alpha2/selectors.json @@ -13,11 +13,11 @@ "type": "string" }, "model": { - "$ref": "https://schemas.meshery.io/v1beta1/model.json#", + "$ref": "../v1beta1/model.json", "description": "Model of the component. Learn more at https://docs.meshery.io/concepts/models" }, "version": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#versionString" + "$ref": "./core.json#/definitions/semverString" }, "match": { "type": "object", @@ -76,11 +76,11 @@ "type": "string" }, "model": { - "$ref": "https://schemas.meshery.io/v1beta1/model.json#", + "$ref": "../v1beta1/model.json", "description": "Model of the component. Learn more at https://docs.meshery.io/concepts/models" }, "version": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#versionString" + "$ref": "./core.json#/definitions/semverString" }, "match": { "type": "object", diff --git a/schemas/constructs/v1beta1/component.json b/schemas/constructs/v1beta1/component.json index c98aaedcaf..62020bc95d 100644 --- a/schemas/constructs/v1beta1/component.json +++ b/schemas/constructs/v1beta1/component.json @@ -6,17 +6,17 @@ "type": "object", "properties": { "schemaVersion": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#versionString", + "$ref": "../v1alpha2/core.json#/definitions/versionString", "description": "Specifies the version of the schema to which the component definition conforms." }, "version": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#semverString", + "$ref": "../v1alpha2/core.json#/definitions/semverString", "description": "Version of the component definition.", "minLength": 1, "maxLength": 50 }, "displayName": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#inputString", + "$ref": "../v1alpha2/core.json#/definitions/inputString", "description": "Name of the component in human-readible format." }, "description": { @@ -30,7 +30,7 @@ "description": "Format specifies the format used in the `component.schema` field. JSON is the default." }, "model": { - "$ref": "https://schemas.meshery.io/v1alpha1/model.json#", + "$ref": "./model.json", "description": "Reference to the specific registered model to which the component belongs and from which model version, category, and other properties may be referenced. Learn more at https://docs.meshery.io/concepts/models" }, "metadata": { diff --git a/schemas/constructs/v1beta1/model.json b/schemas/constructs/v1beta1/model.json index 9fb7561f99..9c2f91da26 100644 --- a/schemas/constructs/v1beta1/model.json +++ b/schemas/constructs/v1beta1/model.json @@ -6,23 +6,23 @@ "type": "object", "properties": { "schemaVersion": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#versionString", + "$ref": "../v1alpha2/core.json#/definitions/versionString", "description": "Specifies the version of the schema used for the definition.", "minLength": 1, "maxLength": 50 }, "version": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#semverString", + "$ref": "../v1alpha2/core.json#/definitions/semverString", "description": "Version of the model definition." }, "name": { - "$ref": "https://schemas.meshery.io/core.json#inputString", + "$ref": "../v1alpha2/core.json#/definitions/inputString", "description": "The unique name for the model within the scope of a registrant.", "minLength": 1, "maxLength": 100 }, "displayName": { - "$ref": "https://schemas.meshery.io/core.json#inputString", + "$ref": "../v1alpha2/core.json#/definitions/inputString", "description": "Human-readable name for the model.", "minLength": 1, "maxLength": 100 @@ -36,13 +36,14 @@ "status": { "type": "string", "description": "Status of model, including:\n- duplicate: this component is a duplicate of another. The component that is to be the canonical reference and that is duplicated by other components should not be assigned the 'duplicate' status.\n- maintenance: model is unavailable for a period of time.\n- enabled: model is available for use for all users of this Meshery Server.\n- ignored: model is unavailable for use for all users of this Meshery Server.", - "enum": ["ignored", "enabled", "duplicate"] + "enum": [ + "ignored", + "enabled", + "duplicate" + ] }, "registrant": { - "$ref": "../v1alpha2/connections.yaml#/components/schemas/connection", - "description": "Kind of the connection responsible for sourcing and registering entities related to this model.", - "minLength": 1, - "maxLength": 100 + "type": "object" }, "category": { "type": "string", @@ -59,7 +60,10 @@ "metadata": { "type": "object", "description": "Metadata containing additional information associated with the model.", - "required": ["name", "version"], + "required": [ + "name", + "version" + ], "properties": { "isAnnotation": { "type": "boolean", @@ -98,10 +102,12 @@ "model": { "type": "object", "description": "Registrant-defined data associated with the model.", - "required": ["version"], + "required": [ + "version" + ], "properties": { "version": { - "$ref": "https://schemas.meshery.io/v1alpha2/core.json#versionString", + "$ref": "../v1alpha2/core.json#/definitions/versionString", "description": "Version of the model as defined by the registrant.", "minLength": 1, "maxLength": 100 @@ -109,5 +115,10 @@ } } }, - "required": ["name", "version", "registrant", "category"] -} + "required": [ + "name", + "version", + "registrant", + "category" + ] +} \ No newline at end of file diff --git a/scripts/merge-openapi-specs.sh b/scripts/merge-openapi-specs.sh index cb45b0cd91..f6c9db0717 100755 --- a/scripts/merge-openapi-specs.sh +++ b/scripts/merge-openapi-specs.sh @@ -5,7 +5,7 @@ echo $folderName process_spec() { echo "processing $1 ..." name=$(basename $1) - redocly bundle $1 -o "$temp_bundle_dir/$name" +redocly bundle --dereferenced $1 -o "$temp_bundle_dir/$name" echo "\n" }