Skip to content
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

HPCC-29554 Use ESDL generated service xml instead of hidl generated c++ code to build the xsds #17585

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

kenrowland
Copy link
Contributor

@kenrowland kenrowland commented Jul 12, 2023

Converted form generation to use new schema generation using service
XML and XSLT transforms

Signed-Off-By: Kenneth Rowland [email protected]

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

@github-actions
Copy link

Copy link
Member

@afishbeck afishbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kenrowland some comments about how transform parameters are handled.

}

void EspHttpBinding::getServiceSchema(IEspContext& context, CHttpRequest* request, const char *serviceQName, const char *methodQName,
Owned<IProperties> &params, double version, EsdlXslTypeId EsdlXslType, StringBuffer &schema)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think params needs to be passed as Owned.
It's also kind of strange that you are modifying the params without knowing how else they might be used by the caller.

Technically it's clear the params are only for this function so looking further, I think it would be better not to pass in the params, but to build the params locally instead. Instead of passing the params maybe add a flags parameter and have flags for thins like "isWsdl" and "AllAnnotations" and based on that add those params here.

@@ -461,8 +461,18 @@ class esp_http_decl EspHttpBinding :
const char *serviceName, const char* methodName);
void sortResponse(IEspContext& context, CHttpRequest* request,MemoryBuffer& contentconst,
const char *serviceName, const char* methodName);

enum SchemaType {
Copy link
Member

@afishbeck afishbeck Jul 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of the internal function having to learn about the name and requirements of the external use case. I'd rather see flags where the caller can specify what features it needs.

  1. "wsdl outupt", which wraps the schema in an extra layer and adds the location of the service.
  2. "Add annotations", which adds additional meta data to the output.
    etc.

In the end most of these use cases just need the schema to know the basic structure of the request. The use case name shouldn't be exposed to the internals.

@kenrowland
Copy link
Contributor Author

@rpastrana
This PR represents the final replacement of generated XSD and WSDL outputs (forms, xml, json, soap, etc.) with XSLT transforms instead of hard coded output in HIDL generated code. Based on previous discussions of the types and the work to ensure they match previous outputs, Tony and I felt it would be a good idea for you to do any Java client testing that you have to make sure there are no problems.

@rpastrana
Copy link
Member

@rpastrana This PR represents the final replacement of generated XSD and WSDL outputs (forms, xml, json, soap, etc.) with XSLT transforms instead of hard coded output in HIDL generated code. Based on previous discussions of the types and the work to ensure they match previous outputs, Tony and I felt it would be a good idea for you to do any Java client testing that you have to make sure there are no problems.

@kenrowland to ensure your changes don't break any downstream clients dependent on the ESP WSDLs, you should compare against legacy WSDLs, for instance here are the eclwatch wsdls used by hpcc4j: https://github.com/hpcc-systems/hpcc4j/tree/master/wsclient/src/main/resources/WSDLs

@afishbeck
Copy link
Member

@kenrowland actually, the title of the PR/Commit should be descriptive of what is actually changing. Something like "Generate native ESP service forms at runtime".. or whatever actually makes sense.

@@ -41,6 +41,8 @@ include_directories (
${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp
${HPCC_SOURCE_DIR}/esp/clients
${HPCC_SOURCE_DIR}/esp/smc/SMCLib
${HPCC_SOURCE_DIR}/esp/esdllib
${HPCC_SOURCE_DIR}/esp/esdllib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same directory listed twice.

@ghalliday
Copy link
Member

This seemed to be stalled in review/responding.

@rpastrana
Copy link
Member

This seemed to be stalled in review/responding.

I'm actively helping Ken test WSDL backward compatibility in an interactive manner, eventually Ken's going to provide a running ESP we can target to automatically create all hpcc4j stub code based on the new WSDLs. BTW @kenrowland we don't have to wait for the 160 to have this change, can you provide a dockerhub image?

@kenrowland
Copy link
Contributor Author

@rpastrana Once we are happy with the comparisons of the WSDLs provided to you, I will update the PR and provide a docker image for others to test.

@rpastrana
Copy link
Member

@rpastrana Once we are happy with the comparisons of the WSDLs provided to you, I will update the PR and provide a docker image for others to test.

As expected, stub code generated fine with WSDL provided, but it seems there's potential for runtime behavior difference (default value directives being ignored).
If the proposed WSDLs no longer honor default value directives, I would ask that we rethink and continue to declare the default vals.

@rpastrana
Copy link
Member

Based on offline discussion, latest change (honoring "default=0" directive) is fine.

Copy link
Member

@afishbeck afishbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reverse the httpbinding.cpp header move to httpbinding.hpp and the cmake changes, unless you had a reason I'm not seeing.

Also please update the PR and commit titles to be a little clearer on what is being changed. Using ESDL generated metadata instead of hidl generated c++ code to build the xsd is much more important that "Improve XSD form generation" implies.

esp/bindings/http/platform/httpbinding.cpp Show resolved Hide resolved
@kenrowland kenrowland force-pushed the HPCC-29554 branch 2 times, most recently from 854a662 to 6695b0b Compare August 25, 2023 18:27
Copy link
Member

@afishbeck afishbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some extra newlines otherwise looks fine.

schema.append("</xsd:schema>");

return true;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of extra newlines here.

@@ -2078,11 +2085,30 @@ static void genSampleXml(StringStack& parent, IXmlType* type, StringBuffer& out,
}
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra whitespace.

}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One extra newline.

getSchema(schema,ctx,request,serviceQName,methodQName,false);
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra newline.

Converted form generation to use new schema generation using service
XML and XSLT transforms
Added legacy schema generation to handle non SCM based ESP services
that don't have a service XML

Signed-Off-By: Kenneth Rowland [email protected]
@kenrowland kenrowland changed the title HPCC-29554 Improve XSD form generation HPCC-29554 Use ESDL generated service xml instead of hidl generated c++ code to build the xsds Aug 29, 2023
@kenrowland
Copy link
Contributor Author

@ghalliday Please merge

rpcreq->serialize(*msg);

StringBuffer req, tag, schema, filtered;
msg->marshall(req, NULL);

getSchema(schema,ctx,request,serv,method,false);
getXMLMessageTag(ctx, true, method, tag);
if (!serviceXmlFilename.isEmpty())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: This block of code is repeated several times. It could be shared.

@ghalliday ghalliday merged commit 0e139d8 into hpcc-systems:master Sep 5, 2023
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants