2

Used the lb4 generators to create models, repositories, and controllers.

When adding a new field to the model, my POST will start to fail with this error: 500 Error: schema is invalid: data.$ref should match format "uri-reference"

The error is too ambiguous, I have zero reference to what it's asking for.

The validation fails when it compares:

$schema = http://json-schema.org/draft-07/schema

$ref = #/components/schemas/New User

edit: Apparently if you add a title option to the controller, it doesn't know what to do with itself

Stoyvo
  • 75
  • 6

2 Answers2

5

Just remove the title from @requestBody. Try the following:

@requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Population, {
            //title: "Add"
            exclude: ['id']
          })
        }
      }
Praveen RL
  • 588
  • 9
  • 13
1

Yeap, same here. Apparently the getModelSchemaRef() "breaks" the model with the Title. I commented that and all run smoothly

LucAB
  • 31
  • 3