New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynapi parameters, io re-engineering #319
Dynapi parameters, io re-engineering #319
Conversation
c9d7ac5
to
428b182
Compare
… check action json paths, if not set use default.
…moved rdf related checks from Parameters class
…s and providedParams to outputParams
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@litvinovg I have reviewed your PR, it looks very well. I have provided a couple of comments. Moreover, the list of classes in the data.types package is a little bit strange, maybe that should be split into two packages.
home/src/main/resources/rdf/tbox/filegraph/vitro-dynamic-api.n3
Outdated
Show resolved
Hide resolved
api/src/main/java/edu/cornell/mannlib/vitro/webapp/dynapi/AbstractPool.java
Outdated
Show resolved
Hide resolved
api/src/main/java/edu/cornell/mannlib/vitro/webapp/dynapi/ActionPool.java
Outdated
Show resolved
Hide resolved
api/src/main/java/edu/cornell/mannlib/vitro/webapp/dynapi/DynamicAPIDocumentation.java
Outdated
Show resolved
Hide resolved
public Parameters getInternalParams() { | ||
return internalParams; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the idea for definition of those internalParams? Is that also defined in n3 description of a dynamic action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameters not required in request, but created for each action. VIVO models is one of such examples
api/src/main/java/edu/cornell/mannlib/vitro/webapp/dynapi/components/Parameter.java
Show resolved
Hide resolved
import edu.cornell.mannlib.vitro.webapp.dynapi.components.Parameters; | ||
import edu.cornell.mannlib.vitro.webapp.utils.configuration.Property; | ||
|
||
public class JsonObjectSerializationType extends SerializationType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why part of this serialization type is Json, and it is not the case for primitive and array serialization types (other classes in this package)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It represents tree structures. So it should be separate, but maybe renamed in future.
} | ||
} else { | ||
try { | ||
if (!isInteger(data.getJsonValue())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is the best way to decouple validator and data, I mean here is explicitly mentioned JSON format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. It is serialized value, I will rename the method. It is also a json representation. So the validator always work with Strings.
Still we will need data specific validators to be applied only to specific data types. That should be resolved in future.
import edu.cornell.mannlib.vitro.webapp.dynapi.components.Parameter; | ||
import edu.cornell.mannlib.vitro.webapp.dynapi.components.Parameters; | ||
|
||
public class SimpleDataView { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an extension of View?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, interface wasn't used. Should be removed.
@@ -0,0 +1,5 @@ | |||
package edu.cornell.mannlib.vitro.webapp.dynapi.data; | |||
|
|||
public interface View { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better that we can really define some interface here (I mean some methods), in this way I am not sure what is the benefit of making hierarchy of object implementing this view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is possible. I think that interface should be removed.
Is this idea for InternalParameters? |
|
Yes. I split that files into two packages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks ok for me now. I still don't like the name JsonObjectSerializationType, but we can consider renaming that later.
* renamed classes * Converted dynamic api ontology to n3 * renamed DefaultAction to NullAction * Moved RESOURCE_ID to RESTEndpoint class * added data view classes * local parameters * started working with json converter * Json validation and jsonPath data loading * get serialized type from ParameterType * tests: fixes for REST endpoint integration test * set required parameters in json schema * inject resource id from url path into json request before validation * refact: move prepareResponse to Converter class from OperationResult * if no acceptContentTypes found use the same content type as input * tests fixes, refactoring, form data converter improvements * Started working on JSON output conversion * Check param json paths for params input/output conversion, if not set check action json paths, if not set use default. * save initializer draft code * fix: fix NPE in RPCEndpointTest * renamed old ParameterType to SerializationType. Created new ParameterType * get serialization info from serialization type name * Extracted RDFType from SerializationType * refact: created isLiteral, isUri, isRdfType methods in ParamterType, moved rdf related checks from Parameters class * feat: added implementation type * added parameter implementation configuration * created parameter converter * array conversion * Removed old converters, operation data, model component. * refact: renamed RawData to Data, renamed requiredParams to inputParams and providedParams to outputParams * Refactored parameter converter. Cache conversion method. * added ModelWriter, restricted access to Data.setObject * content type negotiation * n3 syntax fix * created a few SPARQL query tests, refactored and improved code in SPARQL Query and N3Template * fixes related to review comments * refact: moved implementation related classes to separate package * added sparql query uri input test * refact: removed unused imports and variables. * restricted Data.getObject access modifier to protected
* renamed classes * Converted dynamic api ontology to n3 * renamed DefaultAction to NullAction * Moved RESOURCE_ID to RESTEndpoint class * added data view classes * local parameters * started working with json converter * Json validation and jsonPath data loading * get serialized type from ParameterType * tests: fixes for REST endpoint integration test * set required parameters in json schema * inject resource id from url path into json request before validation * refact: move prepareResponse to Converter class from OperationResult * if no acceptContentTypes found use the same content type as input * tests fixes, refactoring, form data converter improvements * Started working on JSON output conversion * Check param json paths for params input/output conversion, if not set check action json paths, if not set use default. * save initializer draft code * fix: fix NPE in RPCEndpointTest * renamed old ParameterType to SerializationType. Created new ParameterType * get serialization info from serialization type name * Extracted RDFType from SerializationType * refact: created isLiteral, isUri, isRdfType methods in ParamterType, moved rdf related checks from Parameters class * feat: added implementation type * added parameter implementation configuration * created parameter converter * array conversion * Removed old converters, operation data, model component. * refact: renamed RawData to Data, renamed requiredParams to inputParams and providedParams to outputParams * Refactored parameter converter. Cache conversion method. * added ModelWriter, restricted access to Data.setObject * content type negotiation * n3 syntax fix * created a few SPARQL query tests, refactored and improved code in SPARQL Query and N3Template * fixes related to review comments * refact: moved implementation related classes to separate package * added sparql query uri input test * refact: removed unused imports and variables. * restricted Data.getObject access modifier to protected
* renamed classes * Converted dynamic api ontology to n3 * renamed DefaultAction to NullAction * Moved RESOURCE_ID to RESTEndpoint class * added data view classes * local parameters * started working with json converter * Json validation and jsonPath data loading * get serialized type from ParameterType * tests: fixes for REST endpoint integration test * set required parameters in json schema * inject resource id from url path into json request before validation * refact: move prepareResponse to Converter class from OperationResult * if no acceptContentTypes found use the same content type as input * tests fixes, refactoring, form data converter improvements * Started working on JSON output conversion * Check param json paths for params input/output conversion, if not set check action json paths, if not set use default. * save initializer draft code * fix: fix NPE in RPCEndpointTest * renamed old ParameterType to SerializationType. Created new ParameterType * get serialization info from serialization type name * Extracted RDFType from SerializationType * refact: created isLiteral, isUri, isRdfType methods in ParamterType, moved rdf related checks from Parameters class * feat: added implementation type * added parameter implementation configuration * created parameter converter * array conversion * Removed old converters, operation data, model component. * refact: renamed RawData to Data, renamed requiredParams to inputParams and providedParams to outputParams * Refactored parameter converter. Cache conversion method. * added ModelWriter, restricted access to Data.setObject * content type negotiation * n3 syntax fix * created a few SPARQL query tests, refactored and improved code in SPARQL Query and N3Template * fixes related to review comments * refact: moved implementation related classes to separate package * added sparql query uri input test * refact: removed unused imports and variables. * restricted Data.getObject access modifier to protected
* renamed classes * Converted dynamic api ontology to n3 * renamed DefaultAction to NullAction * Moved RESOURCE_ID to RESTEndpoint class * added data view classes * local parameters * started working with json converter * Json validation and jsonPath data loading * get serialized type from ParameterType * tests: fixes for REST endpoint integration test * set required parameters in json schema * inject resource id from url path into json request before validation * refact: move prepareResponse to Converter class from OperationResult * if no acceptContentTypes found use the same content type as input * tests fixes, refactoring, form data converter improvements * Started working on JSON output conversion * Check param json paths for params input/output conversion, if not set check action json paths, if not set use default. * save initializer draft code * fix: fix NPE in RPCEndpointTest * renamed old ParameterType to SerializationType. Created new ParameterType * get serialization info from serialization type name * Extracted RDFType from SerializationType * refact: created isLiteral, isUri, isRdfType methods in ParamterType, moved rdf related checks from Parameters class * feat: added implementation type * added parameter implementation configuration * created parameter converter * array conversion * Removed old converters, operation data, model component. * refact: renamed RawData to Data, renamed requiredParams to inputParams and providedParams to outputParams * Refactored parameter converter. Cache conversion method. * added ModelWriter, restricted access to Data.setObject * content type negotiation * n3 syntax fix * created a few SPARQL query tests, refactored and improved code in SPARQL Query and N3Template * fixes related to review comments * refact: moved implementation related classes to separate package * added sparql query uri input test * refact: removed unused imports and variables. * restricted Data.getObject access modifier to protected
* renamed classes * Converted dynamic api ontology to n3 * renamed DefaultAction to NullAction * Moved RESOURCE_ID to RESTEndpoint class * added data view classes * local parameters * started working with json converter * Json validation and jsonPath data loading * get serialized type from ParameterType * tests: fixes for REST endpoint integration test * set required parameters in json schema * inject resource id from url path into json request before validation * refact: move prepareResponse to Converter class from OperationResult * if no acceptContentTypes found use the same content type as input * tests fixes, refactoring, form data converter improvements * Started working on JSON output conversion * Check param json paths for params input/output conversion, if not set check action json paths, if not set use default. * save initializer draft code * fix: fix NPE in RPCEndpointTest * renamed old ParameterType to SerializationType. Created new ParameterType * get serialization info from serialization type name * Extracted RDFType from SerializationType * refact: created isLiteral, isUri, isRdfType methods in ParamterType, moved rdf related checks from Parameters class * feat: added implementation type * added parameter implementation configuration * created parameter converter * array conversion * Removed old converters, operation data, model component. * refact: renamed RawData to Data, renamed requiredParams to inputParams and providedParams to outputParams * Refactored parameter converter. Cache conversion method. * added ModelWriter, restricted access to Data.setObject * content type negotiation * n3 syntax fix * created a few SPARQL query tests, refactored and improved code in SPARQL Query and N3Template * fixes related to review comments * refact: moved implementation related classes to separate package * added sparql query uri input test * refact: removed unused imports and variables. * restricted Data.getObject access modifier to protected
What does this pull request do?