guardrail
guardrail copied to clipboard
can't use `$ref` in `x-www-form-urlencoded`
This works:
{
"paths": {
"/api/v1/oauth/token/introspect": {
"post": {
"deprecated": false,
"description": "Token introspection for Daml Hub access tokens, as per [rfc7662#section-2](https://datatracker.ietf.org/doc/html/rfc7662#section-2)\n",
"operationId": "introspectAccessToken",
"requestBody": {
"required": true,
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"type": "object",
"properties": {
"token": {
"description": "access token to introspect",
"type": "string"
}
},
"required": [
"token"
]
}
}
}
}
}
}
}
}
But if the inlined schema is moved to a dedicated schema, guardrail code-generation fails:
{
"components": {
"schemas": {
"TokenIntrospectionRequest": {
"properties": {
"token": {
"description": "access token to introspect",
"type": "string"
}
},
"required": [
"token"
],
"type": "object"
}
}
},
"paths": {
"/api/v1/oauth/token/introspect": {
"post": {
"deprecated": false,
"description": "Token introspection for Daml Hub access tokens, as per [rfc7662#section-2](https://datatracker.ietf.org/doc/html/rfc7662#section-2)\n",
"operationId": "introspectAccessToken",
"requestBody": {
"required": true,
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/TokenIntrospectionRequest"
}
}
}
}
}
}
}
}
Unable to generate decoder for application/x-www-form-urlencoded (.paths./api/v1/oauth/token/introspect.operations.POST.consumes[0])
Error:No decoders available (.paths./api/v1/oauth/token/introspect.operations.POST.consumes)
The spec says:
Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place.
A bit late to reply here, I'll beg your pardon. I can't look at this at this moment, unfortunately.
Furthermore, the code to handle this hasn't been centralized, which is an omission in design which needs to get resolved.
Even if this was a blocker for you and you decided to not use guardrail, knowledge about which generator you were using would be helpful to resolve this.
Thank you.
Hey!
knowledge about which generator you were using would be helpful to resolve this.
akka-http server generator