diff --git a/catalog/nats/service/model/generated/nats-service-mapping.yaml b/catalog/nats/service/model/generated/nats-service-mapping.yaml index fbe5e61..4a144bd 100644 --- a/catalog/nats/service/model/generated/nats-service-mapping.yaml +++ b/catalog/nats/service/model/generated/nats-service-mapping.yaml @@ -5,12 +5,12 @@ metadata: service: nats operationCount: 26 sourceInventorySemanticSha256: 0f6fb3a7c5f1f3c8c780724057ef96ca22a7b2d0c2766f493e22d5f444c88ee8 - semanticBridgeSha256: 18af2b80c4e5de810168973053f7e2ff94d11e63dd7f01357d1eee3e9ee07d7f + semanticBridgeSha256: 746005b88bc88a1a51b00c842e23d1a667a381466091d73efc4781c37a0f359b semanticSha256: cb1090244704b4bba63ce1390578f200db29ab297d9e2f25efab061a188d606c extension: - id: https://runtimeconditions.io/extensions/nats/service/0.1.0/runtimeconditions.extension.yaml - version: 0.1.0 - semanticSha256: aef0e170f79d739a505a0ab1a257000a9cc2b5fc85cec537fdcfb69e556aceab + id: https://runtimeconditions.io/extensions/nats/service/0.2.0/runtimeconditions.extension.yaml + version: 0.2.0 + semanticSha256: 9861a18b83aa2a448238ebc09435d0262770f4b7acd1d249a489b1059ac53afc fields: subject: schema: diff --git a/catalog/nats/service/releases/0.2.0/runtimeconditions.extension.yaml b/catalog/nats/service/releases/0.2.0/runtimeconditions.extension.yaml new file mode 100644 index 0000000..28987da --- /dev/null +++ b/catalog/nats/service/releases/0.2.0/runtimeconditions.extension.yaml @@ -0,0 +1,595 @@ +apiVersion: runtimeconditions.io/v1alpha1 +kind: RuntimeConditionsExtensionDefinition +metadata: + id: https://runtimeconditions.io/extensions/nats/service/0.2.0/runtimeconditions.extension.yaml + version: 0.2.0 + semanticSha256: 9861a18b83aa2a448238ebc09435d0262770f4b7acd1d249a489b1059ac53afc +spec: + kinds: + - name: nats.service + interfaceTypes: + - name: service + targetKind: nats.service + interfaceFields: + - name: operations + targetKind: nats.service + targetType: service + fieldValues: + - field: interface.operations[].resource + targetKind: nats.service + targetType: service + values: + - connection + - subject + - stream + - consumer + - key_value + - object_store + - field: interface.operations[].action + targetKind: nats.service + targetType: service + values: + - connect + - consume + - create + - delete + - inspect + - publish + - read + - request + - subscribe + - update + - watch + - write + - field: configuration.env[].property + targetKind: nats.service + targetType: service + values: + - url + - hostname + - port + - username + - password + - token + - tls + - stream + - subject + - consumer + - field: configuration.alternatives[].env[].property + targetKind: nats.service + targetType: service + values: + - url + - hostname + - port + - username + - password + - token + - tls + - stream + - subject + - consumer + schemas: + - id: nats-service-interface + appliesToKind: nats.service + appliesToInterfaceType: service + description: Validates adapter-actionable NATS connection, subject authorization, and JetStream resource requirements. + schema: + $schema: https://json-schema.org/draft/2020-12/schema + type: object + required: + - kind + - interface + properties: + kind: + const: nats.service + interface: + type: object + required: + - type + - operations + properties: + type: + const: service + operations: + type: array + minItems: 1 + uniqueItems: true + items: + oneOf: + - type: object + required: + - resource + - action + properties: + resource: + const: connection + action: + const: connect + additionalProperties: false + - type: object + required: + - resource + - action + - subject + properties: + resource: + const: subject + action: + const: publish + subject: + type: string + minLength: 1 + pattern: ^[^\s]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - subject + properties: + resource: + const: subject + action: + const: subscribe + subject: + type: string + minLength: 1 + pattern: ^[^\s]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - subject + properties: + resource: + const: subject + action: + const: request + subject: + type: string + minLength: 1 + pattern: ^[^\s]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - name + properties: + resource: + const: stream + action: + const: create + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + subjects: + type: array + minItems: 1 + uniqueItems: true + items: + type: string + minLength: 1 + pattern: ^[^\s]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - name + properties: + resource: + const: stream + action: + const: update + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + subjects: + type: array + minItems: 1 + uniqueItems: true + items: + type: string + minLength: 1 + pattern: ^[^\s]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - name + properties: + resource: + const: stream + action: + const: delete + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - name + properties: + resource: + const: stream + action: + const: inspect + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - subject + properties: + resource: + const: stream + action: + const: publish + subject: + type: string + minLength: 1 + pattern: ^[^\s]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - stream + properties: + resource: + const: consumer + action: + const: create + stream: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - stream + properties: + resource: + const: consumer + action: + const: update + stream: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - stream + properties: + resource: + const: consumer + action: + const: delete + stream: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - stream + properties: + resource: + const: consumer + action: + const: inspect + stream: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - stream + properties: + resource: + const: consumer + action: + const: consume + stream: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + name: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: key_value + action: + const: create + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: key_value + action: + const: delete + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: key_value + action: + const: inspect + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: key_value + action: + const: read + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: key_value + action: + const: write + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: key_value + action: + const: watch + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: object_store + action: + const: create + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: object_store + action: + const: delete + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: object_store + action: + const: inspect + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: object_store + action: + const: read + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: object_store + action: + const: write + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + - type: object + required: + - resource + - action + - bucket + properties: + resource: + const: object_store + action: + const: watch + bucket: + type: string + minLength: 1 + pattern: ^[^\s.*>]+$ + additionalProperties: false + additionalProperties: false + additionalProperties: true + - id: nats-service-configuration + appliesToKind: nats.service + appliesToInterfaceType: service + description: Validates NATS-owned environment configuration inputs. + schema: + $schema: https://json-schema.org/draft/2020-12/schema + type: object + properties: + configuration: + $ref: '#/$defs/configuration' + $defs: + configuration: + type: object + oneOf: + - required: + - env + properties: + env: + $ref: '#/$defs/envList' + additionalProperties: false + - required: + - alternatives + properties: + alternatives: + type: array + minItems: 2 + items: + type: object + required: + - env + properties: + env: + $ref: '#/$defs/envList' + additionalProperties: false + additionalProperties: false + envList: + type: array + minItems: 1 + uniqueItems: true + items: + $ref: '#/$defs/envInput' + envInput: + type: object + required: + - property + - name + properties: + property: + enum: + - url + - hostname + - port + - username + - password + - token + - tls + - stream + - subject + - consumer + name: + type: string + pattern: ^[A-Za-z_][A-Za-z0-9_]*$ + sensitive: + type: boolean + required: + type: boolean + additionalProperties: false + conditionFields: + - name: configuration + appliesToKinds: + - nats.service + appliesToInterfaceTypes: + - service diff --git a/catalog/nats/service/tests/test_compile_extension.py b/catalog/nats/service/tests/test_compile_extension.py index bf8bbd6..e55a885 100644 --- a/catalog/nats/service/tests/test_compile_extension.py +++ b/catalog/nats/service/tests/test_compile_extension.py @@ -179,7 +179,11 @@ def test_legacy_inputs_preserve_the_existing_release_in_memory(self): ) extension, mapping = build(self.inventory, bridge) self.assertEqual(extension, read_document(ROOT / "releases/0.1.0/runtimeconditions.extension.yaml")) - self.assertEqual(mapping, read_document(ROOT / "model/generated/nats-service-mapping.yaml")) + self.assertEqual(mapping["metadata"]["operationCount"], self.service_mapping["metadata"]["operationCount"]) + self.assertEqual(mapping["operations"], self.service_mapping["operations"]) + + def test_committed_service_mapping_matches_the_compiler_output(self): + self.assertEqual(self.service_mapping, read_document(ROOT / "model/generated/nats-service-mapping.yaml")) if __name__ == "__main__": diff --git a/catalog/rc/env-configuration/README.md b/catalog/rc/env-configuration/README.md index 80fc2df..17cd00a 100644 --- a/catalog/rc/env-configuration/README.md +++ b/catalog/rc/env-configuration/README.md @@ -22,7 +22,7 @@ extensions: This extension defines the Condition field `configuration`. -This release depends on common-integrations `v1alpha2` and NATS service `0.1.0`. Immutable definition URIs identify those dependencies in the definition and binding metadata; generated profiles use the namespaced `:` references above. Regenerated binding packages therefore depend on both providers' native packages. +This release depends on common-integrations `v1alpha2`. Immutable definition URIs identify that dependency in the definition and binding metadata; generated profiles use the namespaced `:` references above. This extension owns the unqualified Condition field name `configuration` only within the common integration scopes listed in this document. Other extensions diff --git a/tooling/extension-bindings/emitters/java/src/test/java/io/runtimeconditions/bindings/emitter/RealModelsTest.java b/tooling/extension-bindings/emitters/java/src/test/java/io/runtimeconditions/bindings/emitter/RealModelsTest.java index 0bccab3..9437950 100644 --- a/tooling/extension-bindings/emitters/java/src/test/java/io/runtimeconditions/bindings/emitter/RealModelsTest.java +++ b/tooling/extension-bindings/emitters/java/src/test/java/io/runtimeconditions/bindings/emitter/RealModelsTest.java @@ -20,8 +20,6 @@ class RealModelsTest { private static final Path COMMON = TOOLING.resolve("../../bindings/common-integrations/go/runtimeconditions.binding-model.yaml").normalize(); private static final Path ENV = TOOLING.resolve("../../bindings/env-configuration/go/runtimeconditions.binding-model.yaml").normalize(); - private static final String COMMON_ID = - "https://runtimeconditions.io/extensions/rc/common-integrations/v1alpha1/runtimeconditions.extension.yaml"; private static PackageTarget target(String key, String javaPackage, ObjectNode model, List dependencies) { PackageTarget base = developmentTarget(); @@ -63,7 +61,7 @@ void theCommittedFirstPartyModelsEmitPackagesThatCompileIncludingRecursiveMaps() "env-configuration", "io.runtimeconditions.envconfiguration", env, - List.of(new Dependency(COMMON_ID, "io.runtimeconditions", "common-integrations", "io.runtimeconditions.commonintegrations", "0.1.0")))); + List.of(new Dependency(common.path("rootExtension").path("id").asText(), "io.runtimeconditions", "common-integrations", "io.runtimeconditions.commonintegrations", "0.1.0")))); Path envDirectory = workspace.resolve("env"); Source.emitPackage(envPlan, env, envDirectory); Verification.verifyPackage(envPlan, envDirectory, env); diff --git a/tooling/extension-bindings/emitters/typescript/test/real-models.test.ts b/tooling/extension-bindings/emitters/typescript/test/real-models.test.ts index 2572ef6..7b5cb10 100644 --- a/tooling/extension-bindings/emitters/typescript/test/real-models.test.ts +++ b/tooling/extension-bindings/emitters/typescript/test/real-models.test.ts @@ -18,9 +18,6 @@ const ENV = join( TOOLING, "../../bindings/env-configuration/go/runtimeconditions.binding-model.yaml", ); -const COMMON_ID = - "https://runtimeconditions.io/extensions/rc/common-integrations/v1alpha1/runtimeconditions.extension.yaml"; - test( "the committed first-party models emit packages that compile, including recursive maps", { skip: !existsSync(COMMON) || !existsSync(ENV) }, @@ -59,7 +56,7 @@ test( rootExtension: env["rootExtension"].id, dependencies: [ { - extension: COMMON_ID, + extension: common["rootExtension"].id, packageName: "@runtimeconditions/common-integrations", version: "0.1.0", }, diff --git a/tooling/extension-bindings/packages.yaml b/tooling/extension-bindings/packages.yaml index 2b674f2..f0bf7ed 100644 --- a/tooling/extension-bindings/packages.yaml +++ b/tooling/extension-bindings/packages.yaml @@ -37,7 +37,7 @@ packages: go: coordinate: runtimeconditions.io/x/rc/common name: common - version: 0.2.0 + version: 0.3.0 sourceDirectory: bindings/common-integrations/go languageVersion: 1.25.0 publicationMode: github-tag @@ -52,7 +52,7 @@ packages: typescript: coordinate: '@runtimeconditions/common-integrations' name: '@runtimeconditions/common-integrations' - version: 0.2.0 + version: 0.3.0 sourceDirectory: bindings/common-integrations/typescript languageVersion: 20.19.6 publicationMode: registry @@ -64,7 +64,7 @@ packages: go: coordinate: runtimeconditions.io/x/rc/env name: env - version: 0.2.0 + version: 0.3.0 sourceDirectory: bindings/env-configuration/go languageVersion: 1.25.0 publicationMode: github-tag @@ -79,7 +79,7 @@ packages: typescript: coordinate: '@runtimeconditions/env-configuration' name: '@runtimeconditions/env-configuration' - version: 0.2.0 + version: 0.3.0 sourceDirectory: bindings/env-configuration/typescript languageVersion: 20.19.6 publicationMode: registry @@ -139,20 +139,20 @@ packages: publicationMode: registry registryId: npm nats-service: - rootExtension: https://runtimeconditions.io/extensions/nats/service/0.1.0/runtimeconditions.extension.yaml + rootExtension: https://runtimeconditions.io/extensions/nats/service/0.2.0/runtimeconditions.extension.yaml coreProfileSchemaVersion: 0.4.0 languages: go: coordinate: runtimeconditions.io/x/nats/service name: service - version: 0.1.1 + version: 0.2.0 sourceDirectory: bindings/nats-service/go languageVersion: 1.25.0 publicationMode: github-tag python: coordinate: runtimeconditions-nats-service name: runtimeconditions_nats_service - version: 0.1.1 + version: 0.2.0 sourceDirectory: bindings/nats-service/python languageVersion: 3.12.10 publicationMode: registry @@ -160,7 +160,7 @@ packages: typescript: coordinate: '@runtimeconditions/nats-service' name: '@runtimeconditions/nats-service' - version: 0.1.1 + version: 0.2.0 sourceDirectory: bindings/nats-service/typescript languageVersion: 20.19.6 publicationMode: registry