go-openapi / spec

openapi specification object model
Apache License 2.0
389 stars 98 forks source link

add Nullable to Schema #86

Closed rubensayshi closed 5 years ago

rubensayshi commented 5 years ago

As per https://swagger.io/docs/specification/data-models/data-types/#nullable

casualjim commented 5 years ago

This is for a different spec version. in openapi 2.0 we support x-isnullable

codecov[bot] commented 5 years ago

Codecov Report

Merging #86 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #86   +/-   ##
=======================================
  Coverage   44.41%   44.41%           
=======================================
  Files          19       19           
  Lines        2058     2058           
=======================================
  Hits          914      914           
  Misses        973      973           
  Partials      171      171
Impacted Files Coverage Δ
schema.go 26.03% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5bae59e...dfeb175. Read the comment docs.

rubensayshi commented 5 years ago

ah, so how can you add x- properties?

    VendorExtensible: VendorExtensible{Extensions: map[string]interface{}{"x-nullable": true}}

like this?

casualjim commented 5 years ago
definition := getSchemaPtr()
definition.AddExtenstion("x-isnullable", true)
rubensayshi commented 5 years ago

thx @casualjim