Generated OAS incorrectly sets objects as nodes
bladedancer opened this issue · comments
I have an entity that contains a JSONB field - e.g. CORS configuration. This is deserialized as a strongly typed object:
@Include(rootLevel = false, name = "example")
public class Example {
...
@Type(JsonType.class)
private CORS cors;
...
}
Nothing special about CORS, it's just a pojo - it does not have an include annotation.
Expected Behavior
I'd expect the generated OAS to at worst refer to this as an Object and ideally generate a schema for it.
Current Behavior
It's generating the object as if it was a node in the graph.
CORS:
type: object
properties:
type:
type: string
description: ''
id:
type: string
attributes:
required: []
type: object
properties:
accessControlAllowCredentials:
type: boolean
readOnly: false
writeOnly: false
example: null
accessControlAllowHeaders:
type: array
readOnly: false
writeOnly: false
items:
type: object
example: null
accessControlAllowMethods:
type: array
readOnly: false
writeOnly: false
items:
type: object
example: null
accessControlAllowOrigin:
type: array
readOnly: false
writeOnly: false
items:
type: object
example: null
accessControlExposeHeaders:
type: array
readOnly: false
writeOnly: false
items:
type: object
example: null
accessControlMaxAge:
type: integer
format: int32
readOnly: false
writeOnly: false
example: null
relationships:
required: []
type: object
description: 'Update Permissions : (PreAuthorize.Update AND has permission to lock Project Artifact)'
Possible Solution
Digging into it - the CORS is in the EntityBindings that's why getting the alias succeeds and the object is treated as a resource:
A pojo that doesn't have an @include or @entity annotation being in the EntityDictionary seems odd but it is intended - EntityDictionary.discoverEmbeddedTypeBindings.
I presume the fix needs to be that complex attribute types are skipped by JsonApiModelResolver.