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

Nested projections not loading nested lists [DATAREST-408] #785

Closed
spring-projects-issues opened this issue Nov 11, 2014 · 1 comment
Closed

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Nov 11, 2014

Johannes Hiemer opened DATAREST-408 and commented

When nesting projections, Lists/Maps are not included in the processing. Sample:

The following snippet represents the nested projection, which contains a list of limitations.

"name" : "Light",
    "description" : "Light",
    "enabled" : true,
    "limitations" : [ {
      "name" : "Request",
      "description" : "Number of requests per billing period",
      "type" : null,
      "value" : 20.0
    } ],
    "links" : [ ],
    "content" : [ ],
    "links" : [ {
      "rel" : "self",
      "href" : "http://localhost:8080/web/specifications/1310{?projection}"
    }, {
      "rel" : "limitations",
      "href" : "http://localhost:8080/web/specifications/1310/limitations"
    }, {
      "rel" : "product",
      "href" : "http://localhost:8080/web/specifications/1310/product"
    }

Using the parent projection, which contains the nested projection

"name" : "Light",
    "description" : "Light",
    "prices" : [ {
      "value" : -1.0,
      "currency" : "USD",
      "unit" : "Request",
      "period" : "Month",
      "interval" : 1,
      "approximation" : false,
      "component" : null
    } ],
    "productCategory" : {
      "name" : "Price comparison",
      "description" : "Blablablaba"
    },
    "specifications" : [ {
      "name" : "Light",
      "description" : "Light",
      "enabled" : true
    } ],
    "trialPeriod" : null,
    "trialInterval" : 0,
    "links" : [ ],
    "content" : [ ],
    "links" : [ {
      "rel" : "self",
      "href" : "http://localhost:8080/web/products/1300{?projection}"
    }, {
      "rel" : "specifications",
      "href" : "http://localhost:8080/web/products/1300/specifications"
    }, {
      "rel" : "product",
      "href" : "http://localhost:8080/web/products/1300/product"
    }, {
      "rel" : "productCategory",
      "href" : "http://localhost:8080/web/products/1300/productCategory"
    }, {
      "rel" : "accounts",
      "href" : "http://localhost:8080/web/products/1300/accounts"
    } ]

one can see, that all types (int, string) etc. are rendered, but the list not.


Affects: 2.1.4 (Dijkstra SR4), 2.2.1 (Evans SR1)

Issue Links:

  • DATAREST-394 Projections are not applied to collection attributes
    ("duplicates")
  • DATAREST-477 VenueProjection with List<ContactProjection> returns List<Contact> instead
    ("is duplicated by")

Referenced from: commits c979566, e6a19a3, 0cf6139

Backported to: 2.2.2 (Evans SR2), 2.1.5 (Dijkstra SR5)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 14, 2014

Oliver Drotbohm commented

The general issue is in ProjectingMethodInterceptor. It probably needs to inspect the return type more closely. We might want to create a TypeInformation for the return type (using ClassTypeInformation.fromReturnTypeOf(method) and then call the APIs to detect collections and maps, subsequently compare the component and value types and potentially project the individual elements. To create new map and collection instances, Spring's CollectionFactory can be used to create new instances of the original types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants