Skip to content

Commit

Permalink
Merge pull request #18 from fruitriin/type-null-to-nullable
Browse files Browse the repository at this point in the history
fix Type `null` to nullable: true
  • Loading branch information
k0kubun committed Jan 27, 2021
2 parents b26fccf + b575ac3 commit b6e87d9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec/openapi/schema_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def build_type(value)
when ActionDispatch::Http::UploadedFile
{ type: 'string', format: 'binary' }
when NilClass
{ type: 'null' }
{ nullable: true }
else
raise NotImplementedError, "type detection is not implemented for: #{value.inspect}"
end
Expand Down
1 change: 1 addition & 0 deletions spec/rails/app/controllers/tables_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def find_table(id = nil)
id: 2,
name: 'production',
},
null_sample: nil,
storage_size: 12.3,
created_at: time.iso8601,
updated_at: time.iso8601,
Expand Down
15 changes: 15 additions & 0 deletions spec/rails/doc/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ paths:
type: integer
name:
type: string
null_sample:
nullable: true
storage_size:
type: number
format: float
Expand All @@ -61,6 +63,7 @@ paths:
database:
id: 2
name: production
null_sample:
storage_size: 12.3
created_at: '2020-07-17T00:00:00+00:00'
updated_at: '2020-07-17T00:00:00+00:00'
Expand Down Expand Up @@ -116,6 +119,8 @@ paths:
type: integer
name:
type: string
null_sample:
nullable: true
storage_size:
type: number
format: float
Expand All @@ -130,6 +135,7 @@ paths:
database:
id: 2
name: production
null_sample:
storage_size: 12.3
created_at: '2020-07-17T00:00:00+00:00'
updated_at: '2020-07-17T00:00:00+00:00'
Expand Down Expand Up @@ -166,6 +172,8 @@ paths:
type: integer
name:
type: string
null_sample:
nullable: true
storage_size:
type: number
format: float
Expand All @@ -180,6 +188,7 @@ paths:
database:
id: 2
name: production
null_sample:
storage_size: 12.3
created_at: '2020-07-17T00:00:00+00:00'
updated_at: '2020-07-17T00:00:00+00:00'
Expand Down Expand Up @@ -248,6 +257,8 @@ paths:
type: integer
name:
type: string
null_sample:
nullable: true
storage_size:
type: number
format: float
Expand All @@ -262,6 +273,7 @@ paths:
database:
id: 2
name: production
null_sample:
storage_size: 12.3
created_at: '2020-07-17T00:00:00+00:00'
updated_at: '2020-07-17T00:00:00+00:00'
Expand Down Expand Up @@ -297,6 +309,8 @@ paths:
type: integer
name:
type: string
null_sample:
nullable: true
storage_size:
type: number
format: float
Expand All @@ -311,6 +325,7 @@ paths:
database:
id: 2
name: production
null_sample:
storage_size: 12.3
created_at: '2020-07-17T00:00:00+00:00'
updated_at: '2020-07-17T00:00:00+00:00'
Expand Down

0 comments on commit b6e87d9

Please sign in to comment.