guardrail-dev / guardrail-dev/guardrail
Bad reference does not fail compilation inside response
- Dominant language
- Scala
- Stars
- 541
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Description
When using this invalid swagger guardrail generates an empty 404 response instead of failing.
```yaml
swagger: "2.0"
info:
title: "Example API"
version: "1.0.0"
host: "example.com"
basePath: "/api"
schemes:
- "http"
definitions:
SomeData:
type: object
required:
- message
properties:
message:
type: string
responses:
InternalServerError: #500
description: 'Internal Server Error'
schema:
$ref: "#/definitions/SomeData"
paths:
/endpoint:
get:
responses:
'200':
description: 'Successful operation'
schema:
$ref: '#/definitions/SomeData'
'404':
$ref: '#/responses/DoesNotExist'
```
and the bad generated code
```scala
// ...
case class endpointResponseOK(value: api.specification.definitions.SomeData) extends endpointResponse(StatusCodes.OK)
case object endpointResponseNotFound extends endpointResponse(StatusCodes.NotFound)
//...
```
I would expect it to fail saying that the reference was not found like in other situations.
Contributor guide
Assessment
This issue has not been assessed yet.