[PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 opened a new pull request, #8005: URL: https://github.com/apache/nifi/pull/8005 # Summary [NIFI-11627](https://issues.apache.org/jira/browse/NIFI-11627) # Tracking Please complete the following tracking steps prior to pull request creation. ### Issue Tracking - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created ### Pull Request Tracking - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-0` - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-0` ### Pull Request Formatting - [ ] Pull Request based on current revision of the `main` branch - [ ] Pull Request refers to a feature branch with one commit containing changes # Verification Please indicate the verification steps performed prior to pull request creation. ### Build - [ ] Build completed using `mvn clean install -P contrib-check` - [ ] JDK 21 ### Licensing - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html) - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files ### Documentation - [ ] Documentation formatting appears as expected in rendered files -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1808551126 Where would a `json-schema-shared` go in the Maven hiearchy? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1808718378 > Where would a `json-schema-shared` go in the Maven hiearchy? Could I possibly put the `PropertyDescriptor ` in the `JsonSchemaRegistry` interface and then not need `json-schema-shared`? That could also go under `nifi-commons`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1808721485 Sure but could I possibly put the PropertyDescriptor in the JsonSchemaRegistry interface and then not need `json-schema-shared`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1808724417 > Sure but could I possibly put the PropertyDescriptor in the JsonSchemaRegistry interface and then not need `json-schema-shared`? Although it is a semantic difference, it is important for the PropertyDescriptor to be separate from the `JsonSchemaRegistry` interface itself. Properties belong to implementation components, versus interfaces which define expected behavior, so that's the reason for having separate interfaces and separate modules. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1809041146 If I make the changes soon, will this be available for the 1.24 release? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1809061757 > If I make the changes soon, will this be available for the 1.24 release? We are in the process of preparing the initial release candidates for 1.24.0 and 2.0.0-M1 as described on the [dev mailing list thread](https://lists.apache.org/thread/4hks5951z09bbql0cdwfow6zpdwxocwr), so it is less likely to make it into this release cycle, as there may still be some adjustments necessary after testing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1819450265 @exceptionfactory Looks like the failure from the build on Windows Zulu JDK 21 FR has nothing to do with my changes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1840842508 @exceptionfactory Can you please restart the build which failed? It does not seem to have failed as a result of the changes I made. Thank you! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1841173185 @exceptionfactory Sorry to bother you to restart this. This is the exception I see its encountering `Error: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.14.2:install-node-and-npm (install-node-and-npm) on project nifi-web-ui: Could not download Node.js: Could not download https://nodejs.org/dist/v16.13.2/node-v16.13.2-linux-x64.tar.gz: Premature end of Content-Length delimited message body (expected: 32,399,497; received: 1,064,660) -> [Help 1]` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1841235544 > @exceptionfactory This is the exception I see its encountering which has nothing to do with my changes. `Error: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.14.2:install-node-and-npm (install-node-and-npm) on project nifi-web-ui: Could not download Node.js: Could not download https://nodejs.org/dist/v16.13.2/node-v16.13.2-linux-x64.tar.gz: Premature end of Content-Length delimited message body (expected: 32,399,497; received: 1,064,660) -> [Help 1]` > > Does this point to something more problematic with this build or is it just a blip of some sort? That's not a related problem, unfortunately downloading Node.js for front end builds seems unreliable, leading to these intermittent failures. The fact that the other builds completed is sufficient in this case. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416003586 ## nifi-commons/nifi-json-schema-api/src/main/java/org/apache/nifi/schema/access/JsonSchema.java: ## @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schema.access; + +import java.util.Objects; + +public class JsonSchema { +private final SchemaVersion schemaDraftVersion; Review Comment: Recommend renaming this to just `schemaVersion` removing `draft` from the name. ```suggestion private final SchemaVersion schemaVersion; ``` ## nifi-commons/nifi-json-schema-api/src/main/java/org/apache/nifi/schema/access/JsonSchema.java: ## @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schema.access; + +import java.util.Objects; + +public class JsonSchema { +private final SchemaVersion schemaDraftVersion; +private final String schemaText; + +public JsonSchema(SchemaVersion schemaDraftVersion, String schemaText) { +Objects.requireNonNull(schemaDraftVersion, "Schema draft version cannot be null"); +Objects.requireNonNull(schemaText, "The text of the schema cannot be null"); +this.schemaDraftVersion = schemaDraftVersion; +this.schemaText = schemaText; +} + +public SchemaVersion getSchemaDraftVersion() { Review Comment: ```suggestion public SchemaVersion getSchemaVersion() { ``` ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import j
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416045115 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: `LocalJsonSchemaRegistry` ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416049310 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: That's an idea, although it seems to imply that it might not work in a cluster or network, which is not the case. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416045115 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: `LocalJsonSchemaRegistry` as opposed to others which are stored elsewhere? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416126018 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: `InternalJsonSchemaRegistry` ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416162547 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: A one-word prefix would be ideal, so the concept is good. `PersistentJsonSchemaRegistry` might work, as it provides a stronger indication of the lifecycle than `InMemory`. There is always the generic `StandardJsonSchemaRegistry`, but that doesn't say anything about how it works. What do you think about `PropertiesJsonSchemaRegistry`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416188685 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: Is `PersistentJsonSchemaRegistry ` accurate? Would the contents persist after a NIFI shutdown? I thought this would be similar to `AvroSchemaRegistry` which I thought does not persist. Please correct me if am wrong. I like `PropertiesJsonSchemaRegistry` better although I am not sure if there is a consideration to align the naming convention with `AvroSchemaRegistry` or not. As an end user I would expect similar naming conventions in order to associate items with. Essentially the `InMemoryJsonSchemaRegistry` conceptually is the same as `AvroSchemaRegistry` so I would expect a similar name conveying the point that this stores JSON schemas in NIFI instead of Avro Schemas. Could we perhaps change the interface name to `JsonSchemaStore `and name this implementation `JsonSchemaRegistry ` so it aligns more with `AvroSchemaRegistry`? I know it does not align perfectly with the hierarchy for Avro schemas (as its interface is SchemaRegistry which I would have used for all type of schemas). Other implementations would use the suffix `Registry `instead of `Store`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416188685 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: Is `PersistentJsonSchemaRegistry ` accurate? Would the contents persist after a NIFI shutdown? I thought this would be similar to `AvroSchemaRegistry` which I thought does not persist. Please correct me if am wrong. I like `PropertiesJsonSchemaRegistry` better although I am not sure if there is a consideration to align the naming convention with `AvroSchemaRegistry` or not. As an end user I would expect similar naming conventions in order to associate items with. Essentially the `InMemoryJsonSchemaRegistry` conceptually is the same as `AvroSchemaRegistry` so I would expect a similar name conveying the point that this stores JSON schemas in NIFI instead of Avro Schemas. Could we perhaps change the interface name to `JsonSchemaStore `and name this implementation `JsonSchemaRegistry` so it aligns more with `AvroSchemaRegistry`? I know it does not align perfectly with the hierarchy for Avro schemas (as its interface is SchemaRegistry which I would have used for all type of schemas). Other implementations would use the suffix `Registry `instead of `Store`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service,
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416188685 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: Is `PersistentJsonSchemaRegistry ` accurate? Would the contents persist after a NIFI shutdown? I thought this would be similar to `AvroSchemaRegistry` which I thought does not persist. Please correct me if am wrong. I like `PropertiesJsonSchemaRegistry` better although I am not sure if there is a consideration to align the naming convention with `AvroSchemaRegistry` or not. As an end user I would expect similar naming conventions in order to associate items with. Essentially the `InMemoryJsonSchemaRegistry` conceptually is the same as `AvroSchemaRegistry` so I would expect a similar name conveying the point that this stores JSON schemas in NIFI instead of Avro Schemas. Could we perhaps change the interface name to `JsonSchemaStore` and name this implementation `JsonSchemaRegistry` so it aligns more with `AvroSchemaRegistry`? I know it does not align perfectly with the hierarchy for Avro schemas (as its interface is SchemaRegistry which I would have used for all type of schemas). Other implementations would use the suffix `Registry `instead of `Store`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service,
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416188685 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: Is `PersistentJsonSchemaRegistry ` accurate? Would the contents persist after a NIFI shutdown? I thought this would be similar to `AvroSchemaRegistry` which I thought does not persist. Please correct me if am wrong. I like `PropertiesJsonSchemaRegistry` better although I am not sure if there is a consideration to align the naming convention with `AvroSchemaRegistry` or not. As an end user I would expect similar naming conventions in order to associate items with. Essentially the `InMemoryJsonSchemaRegistry` conceptually is the same as `AvroSchemaRegistry` so I would expect a similar name conveying the point that this stores JSON schemas in NIFI instead of Avro Schemas. Could we perhaps change the interface name to `JsonSchemaStore` and name this implementation `JsonSchemaRegistry` so it aligns more with `AvroSchemaRegistry`? I know it does not align perfectly with the hierarchy for Avro schemas (as its interface is SchemaRegistry which I would have used for all type of schemas). Other implementations would use the suffix `Registry` instead of `Store`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service,
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1416213317 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { Review Comment: The schemas are persistent in that they will be maintained in the flow configuration (flow.json.gz), even though temporarily stored in memory. The `AvroSchemaRegistry` is an interesting example, as it simply describes what it is, with no particular indication of how it works. From that angle, I am inclined to just go with `StandardJsonSchemaRegistry`, and keep the interface name as already named. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1420455910 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { + +private static final List PROPERTY_DESCRIPTORS = Collections.singletonList(SCHEMA_VERSION); + +private final ConcurrentMap jsonSchemas; +private final ConcurrentMap schemaFactories; +private volatile SchemaVersion schemaVersion; + +public InMemoryJsonSchemaRegistry() { +jsonSchemas = new ConcurrentHashMap<>(); +schemaFactories = Arrays.stream(SchemaVersion.values()) +.collect(Collectors.toConcurrentMap(Function.identity(), +schemaDraftVersion -> JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.fromId(schemaDraftVersion.getUri()).get(; +schemaVersion = SchemaVersion.valueOf(SCHEMA_VERSION.getDefaultValue()); +} + +@Override +public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { +if (SCHEMA_VERSION.getName().equals(descriptor.getName()) && !newValue.equals(oldValue)) { +schemaVersion = SchemaVersion.valueOf(newValue); +} else if(descriptor.isDynamic() && isBlank(newValue)) { +jsonSchemas.remove(descriptor.getName()); +} else if (descriptor.isDynamic() && isNotBlank(newValue)) { +try { +final String schemaName = descriptor.getName(); +final JsonSchemaFactory jsonSchemaFactory = schemaF
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1420455910 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { + +private static final List PROPERTY_DESCRIPTORS = Collections.singletonList(SCHEMA_VERSION); + +private final ConcurrentMap jsonSchemas; +private final ConcurrentMap schemaFactories; +private volatile SchemaVersion schemaVersion; + +public InMemoryJsonSchemaRegistry() { +jsonSchemas = new ConcurrentHashMap<>(); +schemaFactories = Arrays.stream(SchemaVersion.values()) +.collect(Collectors.toConcurrentMap(Function.identity(), +schemaDraftVersion -> JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.fromId(schemaDraftVersion.getUri()).get(; +schemaVersion = SchemaVersion.valueOf(SCHEMA_VERSION.getDefaultValue()); +} + +@Override +public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { +if (SCHEMA_VERSION.getName().equals(descriptor.getName()) && !newValue.equals(oldValue)) { +schemaVersion = SchemaVersion.valueOf(newValue); +} else if(descriptor.isDynamic() && isBlank(newValue)) { +jsonSchemas.remove(descriptor.getName()); +} else if (descriptor.isDynamic() && isNotBlank(newValue)) { +try { +final String schemaName = descriptor.getName(); +final JsonSchemaFactory jsonSchemaFactory = schemaF
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1420462605 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { + +private static final List PROPERTY_DESCRIPTORS = Collections.singletonList(SCHEMA_VERSION); + +private final ConcurrentMap jsonSchemas; +private final ConcurrentMap schemaFactories; +private volatile SchemaVersion schemaVersion; + +public InMemoryJsonSchemaRegistry() { +jsonSchemas = new ConcurrentHashMap<>(); +schemaFactories = Arrays.stream(SchemaVersion.values()) +.collect(Collectors.toConcurrentMap(Function.identity(), +schemaDraftVersion -> JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.fromId(schemaDraftVersion.getUri()).get(; +schemaVersion = SchemaVersion.valueOf(SCHEMA_VERSION.getDefaultValue()); +} + +@Override +public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { +if (SCHEMA_VERSION.getName().equals(descriptor.getName()) && !newValue.equals(oldValue)) { +schemaVersion = SchemaVersion.valueOf(newValue); +} else if(descriptor.isDynamic() && isBlank(newValue)) { +jsonSchemas.remove(descriptor.getName()); +} else if (descriptor.isDynamic() && isNotBlank(newValue)) { +try { +final String schemaName = descriptor.getName(); +final JsonSchemaFactory jsonSchemaFactory
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1420491373 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { + +private static final List PROPERTY_DESCRIPTORS = Collections.singletonList(SCHEMA_VERSION); + +private final ConcurrentMap jsonSchemas; +private final ConcurrentMap schemaFactories; +private volatile SchemaVersion schemaVersion; + +public InMemoryJsonSchemaRegistry() { +jsonSchemas = new ConcurrentHashMap<>(); +schemaFactories = Arrays.stream(SchemaVersion.values()) +.collect(Collectors.toConcurrentMap(Function.identity(), +schemaDraftVersion -> JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.fromId(schemaDraftVersion.getUri()).get(; +schemaVersion = SchemaVersion.valueOf(SCHEMA_VERSION.getDefaultValue()); +} + +@Override +public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { +if (SCHEMA_VERSION.getName().equals(descriptor.getName()) && !newValue.equals(oldValue)) { +schemaVersion = SchemaVersion.valueOf(newValue); +} else if(descriptor.isDynamic() && isBlank(newValue)) { +jsonSchemas.remove(descriptor.getName()); +} else if (descriptor.isDynamic() && isNotBlank(newValue)) { +try { +final String schemaName = descriptor.getName(); +final JsonSchemaFactory jsonSchemaFactory = schemaF
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1420507222 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { + +private static final List PROPERTY_DESCRIPTORS = Collections.singletonList(SCHEMA_VERSION); + +private final ConcurrentMap jsonSchemas; +private final ConcurrentMap schemaFactories; +private volatile SchemaVersion schemaVersion; + +public InMemoryJsonSchemaRegistry() { +jsonSchemas = new ConcurrentHashMap<>(); +schemaFactories = Arrays.stream(SchemaVersion.values()) +.collect(Collectors.toConcurrentMap(Function.identity(), +schemaDraftVersion -> JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.fromId(schemaDraftVersion.getUri()).get(; +schemaVersion = SchemaVersion.valueOf(SCHEMA_VERSION.getDefaultValue()); +} + +@Override +public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { +if (SCHEMA_VERSION.getName().equals(descriptor.getName()) && !newValue.equals(oldValue)) { +schemaVersion = SchemaVersion.valueOf(newValue); +} else if(descriptor.isDynamic() && isBlank(newValue)) { +jsonSchemas.remove(descriptor.getName()); +} else if (descriptor.isDynamic() && isNotBlank(newValue)) { +try { +final String schemaName = descriptor.getName(); +final JsonSchemaFactory jsonSchemaFactory
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1420614969 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { + +private static final List PROPERTY_DESCRIPTORS = Collections.singletonList(SCHEMA_VERSION); + +private final ConcurrentMap jsonSchemas; +private final ConcurrentMap schemaFactories; +private volatile SchemaVersion schemaVersion; + +public InMemoryJsonSchemaRegistry() { +jsonSchemas = new ConcurrentHashMap<>(); +schemaFactories = Arrays.stream(SchemaVersion.values()) +.collect(Collectors.toConcurrentMap(Function.identity(), +schemaDraftVersion -> JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.fromId(schemaDraftVersion.getUri()).get(; +schemaVersion = SchemaVersion.valueOf(SCHEMA_VERSION.getDefaultValue()); +} + +@Override +public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { +if (SCHEMA_VERSION.getName().equals(descriptor.getName()) && !newValue.equals(oldValue)) { +schemaVersion = SchemaVersion.valueOf(newValue); +} else if(descriptor.isDynamic() && isBlank(newValue)) { +jsonSchemas.remove(descriptor.getName()); +} else if (descriptor.isDynamic() && isNotBlank(newValue)) { +try { +final String schemaName = descriptor.getName(); +final JsonSchemaFactory jsonSchemaFactory = schemaF
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1420621232 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { + +private static final List PROPERTY_DESCRIPTORS = Collections.singletonList(SCHEMA_VERSION); + +private final ConcurrentMap jsonSchemas; +private final ConcurrentMap schemaFactories; +private volatile SchemaVersion schemaVersion; + +public InMemoryJsonSchemaRegistry() { +jsonSchemas = new ConcurrentHashMap<>(); +schemaFactories = Arrays.stream(SchemaVersion.values()) +.collect(Collectors.toConcurrentMap(Function.identity(), +schemaDraftVersion -> JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.fromId(schemaDraftVersion.getUri()).get(; +schemaVersion = SchemaVersion.valueOf(SCHEMA_VERSION.getDefaultValue()); +} + +@Override +public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { +if (SCHEMA_VERSION.getName().equals(descriptor.getName()) && !newValue.equals(oldValue)) { +schemaVersion = SchemaVersion.valueOf(newValue); +} else if(descriptor.isDynamic() && isBlank(newValue)) { +jsonSchemas.remove(descriptor.getName()); +} else if (descriptor.isDynamic() && isNotBlank(newValue)) { +try { +final String schemaName = descriptor.getName(); +final JsonSchemaFactory jsonSchemaFactory
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1420661560 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/InMemoryJsonSchemaRegistry.java: ## @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.schemaregistry.services; + +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.schema.access.JsonSchema; +import org.apache.nifi.schema.access.JsonSchemaRegistryComponent; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schema.access.SchemaVersion; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@Tags({"schema", "registry", "json"}) +@CapabilityDescription("Provides a service for registering and accessing schemas. One can register a schema " ++ "as a dynamic property where 'name' represents the schema name and 'value' represents the textual " ++ "representation of the actual schema following the syntax and semantics of JSON's Schema format. " ++ "Empty schemas and schemas only consisting of whitespace are not acceptable schemas." ++ "The registry is heterogeneous registry as it can store schemas of multiple schema draft versions. " ++ "By default the registry is configured to store schemas of Draft 2020-12. When a schema is added, the version " ++ "which is currently is set, is what the schema is saved as.") +@DynamicProperty(name = "Schema name", value = "Schema Content", +description = "Adds a named schema using the JSON string representation of a JSON schema", +expressionLanguageScope = ExpressionLanguageScope.NONE) +public class InMemoryJsonSchemaRegistry extends AbstractControllerService implements JsonSchemaRegistry, JsonSchemaRegistryComponent { + +private static final List PROPERTY_DESCRIPTORS = Collections.singletonList(SCHEMA_VERSION); + +private final ConcurrentMap jsonSchemas; +private final ConcurrentMap schemaFactories; +private volatile SchemaVersion schemaVersion; + +public InMemoryJsonSchemaRegistry() { +jsonSchemas = new ConcurrentHashMap<>(); +schemaFactories = Arrays.stream(SchemaVersion.values()) +.collect(Collectors.toConcurrentMap(Function.identity(), +schemaDraftVersion -> JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.fromId(schemaDraftVersion.getUri()).get(; +schemaVersion = SchemaVersion.valueOf(SCHEMA_VERSION.getDefaultValue()); +} + +@Override +public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { +if (SCHEMA_VERSION.getName().equals(descriptor.getName()) && !newValue.equals(oldValue)) { +schemaVersion = SchemaVersion.valueOf(newValue); +} else if(descriptor.isDynamic() && isBlank(newValue)) { +jsonSchemas.remove(descriptor.getName()); +} else if (descriptor.isDynamic() && isNotBlank(newValue)) { +try { +final String schemaName = descriptor.getName(); +final JsonSchemaFactory jsonSchemaFactory = schemaF
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1847516537 @exceptionfactory Sorry I had a Checkstyle violation as I had not removed an unused import. I have fixed that and pushed the change. Can you please at your earliest convenience restart the builds? Thank you! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1854671022 @exceptionfactory I know you are a busy man but when you get a chance can you please review the latest changes? Thank you! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1435301326 ## nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateJson.java: ## @@ -79,65 +92,69 @@ } ) public class ValidateJson extends AbstractProcessor { -public enum SchemaVersion implements DescribedValue { -DRAFT_4("Draft Version 4", "Draft 4", VersionFlag.V4), -DRAFT_6("Draft Version 6", "Draft 6", VersionFlag.V6), -DRAFT_7("Draft Version 7", "Draft 7", VersionFlag.V7), -DRAFT_2019_09("Draft Version 2019-09", "Draft 2019-09", VersionFlag.V201909), -DRAFT_2020_12("Draft Version 2020-12", "Draft 2020-12", VersionFlag.V202012); - -private final String description; -private final String displayName; -private final VersionFlag versionFlag; - -SchemaVersion(String description, String displayName, VersionFlag versionFlag) { -this.description = description; -this.displayName = displayName; -this.versionFlag = versionFlag; -} -@Override -public String getValue() { -return name(); -} +public static final String SCHEMA_NAME_PROPERTY_NAME = "Schema Name"; +public static final String SCHEMA_CONTENT_PROPERTY_NAME = "JSON Schema"; +public static final String ERROR_ATTRIBUTE_KEY = "json.validation.errors"; +public static final AllowableValue SCHEMA_NAME_PROPERTY = new AllowableValue("schema-name", "Use '" + SCHEMA_NAME_PROPERTY_NAME + "' Property", +"The name of the Schema to use is specified by the '" + SCHEMA_NAME_PROPERTY_NAME + +"' Property. The value of this property is used to lookup the Schema in the configured JSON Schema Registry service."); +public static final AllowableValue SCHEMA_CONTENT_PROPERTY = new AllowableValue("schema-content-property", "Use '" + SCHEMA_CONTENT_PROPERTY_NAME + "' Property", +"A URL or file path to the JSON schema or the actual JSON schema is specified by the '" + SCHEMA_CONTENT_PROPERTY_NAME + "' Property. " + +"No matter how the JSON schema is specified, it must be a valid JSON schema"); Review Comment: It would be helpful to switch from the `AllowableValue` class definition to an enum that implements `DescribedValue`, making it easier to work with selected values in the component itself. ## nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateJson.java: ## @@ -79,65 +92,69 @@ } ) public class ValidateJson extends AbstractProcessor { -public enum SchemaVersion implements DescribedValue { -DRAFT_4("Draft Version 4", "Draft 4", VersionFlag.V4), -DRAFT_6("Draft Version 6", "Draft 6", VersionFlag.V6), -DRAFT_7("Draft Version 7", "Draft 7", VersionFlag.V7), -DRAFT_2019_09("Draft Version 2019-09", "Draft 2019-09", VersionFlag.V201909), -DRAFT_2020_12("Draft Version 2020-12", "Draft 2020-12", VersionFlag.V202012); - -private final String description; -private final String displayName; -private final VersionFlag versionFlag; - -SchemaVersion(String description, String displayName, VersionFlag versionFlag) { -this.description = description; -this.displayName = displayName; -this.versionFlag = versionFlag; -} -@Override -public String getValue() { -return name(); -} +public static final String SCHEMA_NAME_PROPERTY_NAME = "Schema Name"; +public static final String SCHEMA_CONTENT_PROPERTY_NAME = "JSON Schema"; +public static final String ERROR_ATTRIBUTE_KEY = "json.validation.errors"; +public static final AllowableValue SCHEMA_NAME_PROPERTY = new AllowableValue("schema-name", "Use '" + SCHEMA_NAME_PROPERTY_NAME + "' Property", +"The name of the Schema to use is specified by the '" + SCHEMA_NAME_PROPERTY_NAME + +"' Property. The value of this property is used to lookup the Schema in the configured JSON Schema Registry service."); +public static final AllowableValue SCHEMA_CONTENT_PROPERTY = new AllowableValue("schema-content-property", "Use '" + SCHEMA_CONTENT_PROPERTY_NAME + "' Property", +"A URL or file path to the JSON schema or the actual JSON schema is specified by the '" + SCHEMA_CONTENT_PROPERTY_NAME + "' Property. " + +"No matter how the JSON schema is specified, it must be a valid JSON schema"); -@Override -public String getDisplayName() { -return displayName; -} +private static final List STRATEGY_LIST = Arrays.asList(SCHEMA_NAME_PROPERTY, SCHEMA_CONTENT_PROPERTY); -@Override -public String getDescription() { -
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on PR #8005: URL: https://github.com/apache/nifi/pull/8005#issuecomment-1869144546 @exceptionfactory The failure of the 'dependency-check / Dependency Check' build seems to be unrelated to my changes. Error message is ``` Unable to download meta file: https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-modified.meta org.owasp.dependencycheck.data.update.exception.UpdateException: Unable to download meta file: https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-modified.meta ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory closed pull request #8005: NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. URL: https://github.com/apache/nifi/pull/8005 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389824324 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Since this is an API module, this dependency should be removed. The `SchemaVersion` should not have a direct reference to the library class. Although there may be some small duplication, do not recommend placing the PropertyDescriptor in a shared module for now. ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils Review Comment: I recommend naming this module `nifi-json-schema-api` to indicate that it is intended to provide a public interface for multiple components. ```suggestion nifi-json-schema-api ``` ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + Review Comment: This should not be necessary since it is set in the root Maven configuration. ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/pom.xml: ## @@ -52,5 +57,22 @@ language governing permissions and limitations under the License. --> commons-io commons-io + +com.networknt +json-schema-validator +1.0.86 + + + + +org.apache.maven.plugins +maven-compiler-plugin + +8 +8 + + + + Review Comment: This configuration should not be necessary since the minimum Java version is 21 in the root Maven configuration. ## nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml: ## @@ -766,6 +771,14 @@ + +org.apache.maven.plugins +maven-compiler-plugin + +8 +8 + + Review Comment: ```suggestion ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389836854 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Addressing he first point. The dependency is needed for `SchemaVersion` enum as it used to be in ValidateJson and it uses `SpecVersion.VersionFlag` which is part of the dependency. As for your second point, where should I put the `PropertyDescriptor` as I created a common one `SCHEMA_VERSION` used in `ValidateJson` and `InMemoryJsonSchemaRegistry` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389837400 ## nifi-nar-bundles/nifi-registry-bundle/nifi-registry-service/pom.xml: ## @@ -52,5 +57,22 @@ language governing permissions and limitations under the License. --> commons-io commons-io + +com.networknt +json-schema-validator +1.0.86 + + + + +org.apache.maven.plugins +maven-compiler-plugin + +8 +8 + + + + Review Comment: I have removed that -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389836854 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Addressing your first point. The dependency is needed for `SchemaVersion` enum as it used to be in ValidateJson and it uses `SpecVersion.VersionFlag` which is part of the dependency. As for your second point, where should I put the `PropertyDescriptor` as I created a common one `SCHEMA_VERSION` used in `ValidateJson` and `InMemoryJsonSchemaRegistry` ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Addressing your first point. The dependency is needed for the `SchemaVersion` enum as it used to be in ValidateJson and it uses `SpecVersion.VersionFlag` which is part of the dependency. As for your second point, where should I put the `PropertyDescriptor` as I created a common one `SCHEMA_VERSION` used in `ValidateJson` and `InMemoryJsonSchemaRegistry` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389836854 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Addressing your first point. The dependency is needed for the `SchemaVersion` enum as it used to be in `ValidateJson` and it uses `SpecVersion.VersionFlag` which is part of the dependency. As for your second point, where should I put the `PropertyDescriptor` as I created a common one `SCHEMA_VERSION` used in `ValidateJson` and `InMemoryJsonSchemaRegistry` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389838465 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + Review Comment: I have removed that and I will check that in on my next commit -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389838896 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Thanks for the quick reply. Instead of having the enum include a reference to the `VersionFlag`, the Processor should have a translation method to determine the VersionFlag from the `SchemaVersion` value. In this particular case, I recommend simply duplicating the Property Descriptor definition in both components. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389839102 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils Review Comment: With this change, does this module still belong in `nifi-commons`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389840412 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils Review Comment: Good question. There are a few other API modules under nifi-commons, so this still seems like a reasonable location. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389857197 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: So this translation method will be needed in `ValidateJson` and `InMemoryJsonSchemaRegistry`. Where could i place this common method so it is not duplicated? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389857197 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: So this translation method will be needed in `ValidateJson` and `InMemoryJsonSchemaRegistry`. Where could i place this common method so it is not duplicated? That is why I wanted to keep everything in the enum so no method to translate is necessary. Please advise. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389872490 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Does the Registry implementation need the translation method? It seems like it is just storing the text and version information, so the translation method could be in ValidateJson. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389874852 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: It uses the translation to validate the schema in the customValidate to ensure one enters a valid schema per the version. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389874852 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: It uses the translation to validate the schema in the `customValidate` to ensure one enters a valid schema per the version. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389874852 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Yes, it uses the translation to validate the schema in the `customValidate` to ensure one enters a valid schema per the version. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389874852 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Yes, it uses the translation to load the correct factory to build the schema per the version in the `customValidate` to ensure one enters a valid schema per the version. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1389887565 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Reviewing the [VersionFlag](https://github.com/networknt/json-schema-validator/blob/master/src/main/java/com/networknt/schema/SpecVersion.java#L24) code, it looks like the `id` field is the URI of the schema version. Adding the URI value to the `SchemaVersion` seems like a good approach, and then it is simply a matter of calling `VersionFlag.fromId()`, so no shared utility should be needed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
dan-s1 commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1390482375 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: That is a great idea. I will look to implement that. As regards to defining a common `PropertyDescriptor`, I followed the practice I saw in` nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/SchemaAccessUtils.java` where a handful of `PropertyDescriptor` variables are defined. In addition I wanted to avoid what I saw in #7890 where there was a cut and paste of multiple `PropertyDescriptor` variables in two separate JOLT processors and as a result the same bug had to be fixed in both places. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-11627 Added an in memory JSON schema registry which ValidationJson can now use to retrieve JSON schemas from for validation. [nifi]
exceptionfactory commented on code in PR #8005: URL: https://github.com/apache/nifi/pull/8005#discussion_r1391181164 ## nifi-commons/nifi-json-schema-utils/pom.xml: ## @@ -0,0 +1,40 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi-commons +2.0.0-SNAPSHOT + +nifi-json-schema-utils + +UTF-8 + + + + org.apache.nifi + nifi-api + + + com.networknt + json-schema-validator + 1.0.86 + Review Comment: Thanks for highlighting the positives and negatives of a shared PropertyDescriptor. For one property, the value seems marginal, but it could have some usefulness. For shared PropertyDescriptors, I recommend an approach like the [KafkaClientComponent](https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-shared/src/main/java/org/apache/nifi/kafka/shared/component/KafkaClientComponent.java) which is an interface that consists exclusively of Property Descriptors. At that point, the question is where this should be placed, as it should not be considered part of the API per se. Following the above approach, a `json-schema-shared` library seems the most logical. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org