References
- CPS-1257Getting issue details... STATUS
Issues & Decisions
# | Issue | Notes | Decision |
---|---|---|---|
1 | Requests with "application/xml" content type body are not processed - spring returns 415 response "Unsupported Media Type" | Setting application/xml content type request body on OpenAPI spec file generates a code which has "Consumes = {"application/xml"} annotation, but if client send a request with XML content type it's not accepted by Spring. Solution is to add Jackson dataformat XML dependency to pom file. It was tested before we got a dedicated meeting related with that issue but looks like maven didn't download/update that dependency properly. | |
2 | XML content is preprocessed by Spring and passed as a Java object into DataRestController createNode method instead of string | The main reason of providing that change is an issue related with JSON → XML conversion (described on Jira ticket). Spring is doing conversion from XML string into LinkedHashMap object before passing it as a parameter into DataRestController createNode method. It's related with setting requestBody schema type as object in OpenAPI spec file. Solution is to pass not preprocessed string into method, so Spring won't do any preprocessing. It makes sense as on the first line of createNode method we convert that object into string again. | |
3 | How to determine if content we get is JSON or XML | As we are going to support both JSON and XML content it's needed to determine which format user use on request body. That can be done using JsonObjectMapper.convertToJsonNode method - call it with content string as a parameter and if method raises JsonProcessingException we can treat a string as XML content |