rspec-openapi icon indicating copy to clipboard operation
rspec-openapi copied to clipboard

Type added manually gets erased when merging

Open dgmora opened this issue 5 months ago • 3 comments

Because of my specs, the following definition is generated:

  properties:
    first_name:
      nullable: true

To solve that, I manually edited the generated file (as indicated here) to have

  properties:
    name:
      nullable: true
      type: string

This however gets overwritten when re-generating the specs, the type gets lost. I've narrowed this down to this call:

# base = {:nullable=>true, :type=>"string"}
# spec = {:nullable=>true}
merge_schema!(base, spec)

This leaves you with {:nullable=>true}. Since you are iterating spec's keys and spec does not have type, the type gets removed. I wanted to confirm if this is a bug or not. I'm not sure if this somehow conflicts with 'removing' things that aren't present anymore in the API responses?

dgmora avatar Sep 24 '24 14:09 dgmora