menu
announcement

Spectrum will become read-only on August 10, 2021. Learn more about the decision in our official announcement.

Elide

Elide is a java library built to make it easy to expose JPA beans as either a JSON API or a GraphQL webservice

Channels
Team

elide-spring-boot-starter problem

March 28, 2021 at 5:52pm

elide-spring-boot-starter problem

March 28, 2021 at 5:52pm (Edited 4 months ago)
Build project with elide-spring-boot-starter - 5.0.0-pr32 I use elide-spring-boot-example project like example for my project. https://github.com/Goganesh/jsonApi-java-example/tree/master/education A have some problems with json api spec:
  1. Fields request - http://localhost:8080/json/materials?fields[materials]=name result - 400 bad request Invalid character found in the request target [/json/materials?page[size]=2&page[number]=1]. The valid characters are defined in RFC 7230 and RFC 3986
  2. Pagination request - request http://localhost:8080/json/materials?page[size]=2&page[number]=1 result - 400 bad request Invalid character found in the request target [/json/materials?page[size]=2&page[number]=1]. The valid characters are defined in RFC 7230 and RFC 3986
  3. Documentation problem request - http://localhost:8080/doc result - []
What is my problem ? Help me please

March 29, 2021 at 2:24pm
1 & 2 are probably related to using tomcat and its newer, strict, default behavior for some characters:
Edited
  • reply
  • like
If you use Jetty (look at example repo pom) or configure tomcat correctly, those issues should resolve.
Edited
  • reply
  • like
Even though these are reserved characters, they are commonly used in REST APIs
  • reply
  • like
Square braces for example are baked into the JSON-API spec for things like sparse field:
Edited
  • reply
  • like
For (3), you are setting the API version of your swagger document to "1.0"
  • reply
  • like
But none of your models are versioned
  • reply
  • like
I recommend removing the elide.swagger.version flag in your application.yaml
  • reply
  • like
Then your unversioned models will show up in your unversioned swagger document.
  • reply
  • like
I think the docs are not adequate to describe this nuance. I'm going to file an issue to improve the documentation for swagger API versions.
  • reply
  • like
Thanks, all my problems is solved)
  • reply
  • like