guardrail-dev / guardrail-dev/guardrail

No way to access `default`, `minimum`, `maximum` on Schemas that are `integer` type:

Open
#1,651 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
541
Forks
138
PR merge metrics
No merged PRs in 30d

Description

```json
{
"components": {
"schemas": {
"TokenExpirationSeconds": {
"type": "integer",
"description": "The number of seconds until the generated token expires.",
"format": "int32",
"default": 3600,
"example": 3600,
"minimum": 15,
"maximum": 86400
},
"PersonalAccessToken": {
"type": "object",
"properties": {
"expires_in": {
"$ref": "#/compnenets/schemas/TokenExpirationSeconds"
}
}
}
}
}
}
```

All i get in the generated code is
```scala
case class PersonalAccessToken(expiresIn: Option[Int] = Option(3600))
```

I'd ideally be able to access these constants in some way. Only the `default` is present in the generated code at all.

Contributor guide

Open the contributing guide

Research direction

The report concerns generated Scala case classes from OpenAPI schemas; begin by reproducing the TokenExpirationSeconds and PersonalAccessToken example and tracing how default, minimum, and maximum are represented. Done means the generated API exposes the requested integer-schema constants while preserving the existing default behavior, with coverage for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, scala
Domain
backend-api-design, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.