Skip to content

Commit

Permalink
Include nullability in OpenAPI metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
xeger committed Jan 24, 2022
1 parent f57362f commit cd58fb4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/praxis/docs/open_api/schema_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def initialize(info:)
if info.is_a?(Attributor::Attribute)
@type = info.type
@enum = info.options[:values]
@nullable = info.options[:null]
else
@type = info
end
Expand Down Expand Up @@ -54,6 +55,7 @@ def dump_schema(shallow: false, allow_ref: false)
schema = type.as_json_schema(shallow: shallow, example: nil)
# TODO: should this sort of logic be moved into as_json_schema?
schema.merge!(enum: @enum) if @enum
schema.merge!(nullable: true) if @nullable
schema
end

Expand Down

0 comments on commit cd58fb4

Please sign in to comment.