apia-open_api 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6621197f4a9535afae13e2a83de1fc5993290f379660e347afe989e94f3179ba
4
- data.tar.gz: a932546d15d8302931a4c55d1fa4fa1e088b4f74ee7b227d0817de5f7b3f6dbb
3
+ metadata.gz: ce32b2c3d98cff03c533669e56c860dcda6b97a0deb554d423f8c208645ea87a
4
+ data.tar.gz: 9f9d5b952f2cc7141a0c207fa8d43c9d5d7a2a617dabb1819bb07e6a7decc691
5
5
  SHA512:
6
- metadata.gz: d5bb084664b9a2729f8b0fb8408c8cd66eb6b8a637255582aba4c01cf5867eb2b88b5de5d1baba1eb4ebbece5f8d7353a7bedcbe68abe75036c7be9578a1a5c3
7
- data.tar.gz: b99e2cc62ea871c657cbe523e1680d78f3341919b0a726d0fd6548635173a2064027c5c927d1a246be3120a508366e4627e4351c0040951d30a84694316fda3f
6
+ metadata.gz: 5b83929f1bc986f6ce7d8d736f30b76992868bd6442d72b9f8456d83537bc91b1b8d4297ad94655aaf86720d40468305215f2e28fcd61f63253ee9d24fc59874
7
+ data.tar.gz: 13c108fcb4596a5912781732192e4bac034c6dd7a441e951edff6b740515e188a3ee03ba73cb63c518f235bff5a57b09a0dd3a8f3dcff77f79ccfb81edfbb61c
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in apia-open_api.gemspec
6
6
  gemspec
7
7
 
8
- gem "apia", "~> 3.5"
8
+ gem "apia", "~> 3.7"
9
9
  gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
  gem "rubocop", "~> 1.21"
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Apia OpenAPI Specification
2
2
 
3
- This gem can generate an [OpenAPI](https://www.openapis.org/) compatible schema from an API implemented using [Apia](https://github.com/krystal/apia).
3
+ This gem can generate an [OpenAPI](https://www.openapis.org/) compatible schema from an API implemented using [Apia](https://github.com/apiaframework/apia).
4
4
 
5
5
  This gem is in the early phases of development and breaking changes may be introduced whilst the gem is in the 0.1.x version range.
6
6
 
@@ -12,7 +12,7 @@ Install the gem and add to the application's Gemfile by executing:
12
12
 
13
13
  ## Usage
14
14
 
15
- The schema can be mounted in much the same way as an [Apia API](https://github.com/krystal/apia) itself.
15
+ The schema can be mounted in much the same way as an [Apia API](https://github.com/apiaframework/apia) itself.
16
16
 
17
17
  For example, for a Ruby on Rails application:
18
18
 
@@ -85,7 +85,7 @@ You can also run `bin/console` for an interactive prompt that will allow you to
85
85
 
86
86
  ## Contributing
87
87
 
88
- Bug reports and pull requests are welcome on GitHub at https://github.com/krystal/apia-open_api.
88
+ Bug reports and pull requests are welcome on GitHub at https://github.com/apiaframework/apia-open_api.
89
89
 
90
90
  ## License
91
91
 
@@ -8,13 +8,13 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Paul Sturgess"]
9
9
 
10
10
  spec.summary = "Apia OpenAPI spec generator"
11
- spec.homepage = "https://github.com/krystal/apia-openapi"
11
+ spec.homepage = "https://github.com/apiaframework/apia-openapi"
12
12
  spec.license = "MIT"
13
13
  spec.required_ruby_version = ">= 2.7.0"
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://github.com/krystal/apia-openapi"
17
- spec.metadata["changelog_uri"] = "https://github.com/krystal/apia-openapi/changelog.md"
16
+ spec.metadata["source_code_uri"] = "https://github.com/apiaframework/apia-openapi"
17
+ spec.metadata["changelog_uri"] = "https://github.com/apiaframework/apia-openapi/changelog.md"
18
18
 
19
19
  spec.metadata["rubygems_mfa_required"] = "false" # rubocop:disable Gemspec/RequireMFA (enabling MFA means we cannot auto publish via the CI)
20
20
 
@@ -36,6 +36,7 @@ module Apia
36
36
  @route_spec = route_spec
37
37
  @api_authenticator = api_authenticator
38
38
  @http_status = @endpoint.definition.http_status
39
+ @response_type = @endpoint.definition.response_type
39
40
  end
40
41
 
41
42
  def add_to_spec
@@ -46,9 +47,14 @@ module Apia
46
47
  private
47
48
 
48
49
  def add_sucessful_response_schema
49
- content_schema = {
50
- properties: generate_properties_for_successful_response
51
- }
50
+ if @response_type == Apia::Response::PLAIN
51
+ content_schema = { type: "string" }
52
+ else
53
+ content_schema = {
54
+ properties: generate_properties_for_successful_response
55
+ }
56
+ end
57
+
52
58
  required_fields = @endpoint.definition.fields.select { |_, field| field.condition.nil? }
53
59
  content_schema[:required] = required_fields.keys if required_fields.any?
54
60
 
@@ -56,7 +62,7 @@ module Apia
56
62
  "#{@http_status}": {
57
63
  description: @endpoint.definition.description || "",
58
64
  content: {
59
- "application/json": {
65
+ @response_type => {
60
66
  schema: content_schema
61
67
  }
62
68
  }
@@ -3,7 +3,7 @@
3
3
  module Apia
4
4
  module OpenApi
5
5
 
6
- VERSION = "0.1.6"
6
+ VERSION = "0.1.7"
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apia-open_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Sturgess
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2024-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -47,13 +47,13 @@ files:
47
47
  - lib/apia/open_api/rack.rb
48
48
  - lib/apia/open_api/specification.rb
49
49
  - lib/apia/open_api/version.rb
50
- homepage: https://github.com/krystal/apia-openapi
50
+ homepage: https://github.com/apiaframework/apia-openapi
51
51
  licenses:
52
52
  - MIT
53
53
  metadata:
54
- homepage_uri: https://github.com/krystal/apia-openapi
55
- source_code_uri: https://github.com/krystal/apia-openapi
56
- changelog_uri: https://github.com/krystal/apia-openapi/changelog.md
54
+ homepage_uri: https://github.com/apiaframework/apia-openapi
55
+ source_code_uri: https://github.com/apiaframework/apia-openapi
56
+ changelog_uri: https://github.com/apiaframework/apia-openapi/changelog.md
57
57
  rubygems_mfa_required: 'false'
58
58
  post_install_message:
59
59
  rdoc_options: []