Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-153494

YAML allOf not implemented according to OpenAPI spec


    • Bug
    • Status: Verified
    • Resolution: Unresolved
    • Master
    • None
    • REST Builder
    • None
    • 3


      The OpenAPI 3.0 specification states the following: Composition and Inheritance (Polymorphism) §

      The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.


      This is not the behaviour of REST Builder. It correctly generates types using  a composition approach, however the resulting serialization doesn't combine these into a "single object".

      Steps to reproduce

      1. Add the attached openapi.yaml file to a headless module and execute

      gw buildREST

      2. Implement the ProviderConfigurationResourceImpl#getProviderConfiguration() method enough so all the properties are set.

      3. Add a Service Access Policy to allow guest access to the endpoint. It should be set to default=true . The class to allow should be similar to (depends on your module's package structure): 


      Note that the class is the "Impl" class, not the generated interface class.

      You can use a * (asterisk) for the method to allow.

      4. Execute

      curl http://liferaysamlsp.com:8080/o/saml-admin/v1.0/provider

      (Change the /saml-admin to whatever baseURI is set in your module's rest-config.yaml)

      5. Assert the JSON structure of the HTTP response body:

       Expected result:

       "enabled": true,
       "roleType": "string",
       "idpProperty": true

       Actual result:

       "baseProviderConfiguration" : {
       "enabled" : true,
       "roleType" : "IdpProviderConfiguration"
       "idpProperty" : true


      Note: Adding @JSONUnwrapped to the composition fields of the generated SpProviderConfigurationIdpProviderConfiguration gives the excepted result in this case


        Issue Links



              support-lep@liferay.com SE Support
              stian.sigvartsen Stian Sigvartsen
              Kiyoshi Lee Kiyoshi Lee
              0 Vote for this issue
              0 Start watching this issue


                20 weeks, 2 days ago


                  Version Package