webspicy 0.21.5 → 0.21.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a55b29fa6f9f5f48358b4a050582679f7e32816b82ea818c3f8d07ee1f6e166
4
- data.tar.gz: 045b1c9ea0127645ddfd8bb14a7b464daa1c9a309d0796d31898800f7629637e
3
+ metadata.gz: ebc6a59cdd54771817e5613d8a5ecf53651034453c801d3e505fc30d39851bed
4
+ data.tar.gz: e5ee25c0870072c02c69e6a90e2a6803de5dba78062b59b3bd8f1c183a7d91e4
5
5
  SHA512:
6
- metadata.gz: d8d6e028b67558796b58b9a24ec27e0594b33160613838e211557a75e924447acafe9c75ead65a2d91cc4c62b55b714b8c45a9af1af3ad3d30f1ad80a379fce6
7
- data.tar.gz: 251d467be2ec28bf4dd9f6026b71dae998290911bb613a53a540c888e2287ae7b9d81c57e947f35c451c7c975b096709692c44dddc1534204895dcc24613dca5
6
+ metadata.gz: 0f8632e1117aa06d2b717b790f2150d35a305ee37f2de912f5b412decfe969d3a78f3470f9074a7eb35c6d2180adf9c3d0f02f6629628f7e07e4c18428378640
7
+ data.tar.gz: 9ef40e507cfb9e50de794dc1d9f593adf4e92f318aa1fd37a6ab4a13035c1977b308ae483e0d017838a6bb9143264b3d6f6dbe34dfdbfc1808ec0076c24d9490
@@ -29,6 +29,10 @@ module Webspicy
29
29
  @raw[:description]
30
30
  end
31
31
 
32
+ def conditions
33
+ preconditions + postconditions
34
+ end
35
+
32
36
  def preconditions
33
37
  @preconditions ||= compile_preconditions
34
38
  end
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 21
5
- TINY = 5
5
+ TINY = 7
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -0,0 +1,18 @@
1
+ module Webspicy
2
+ class Specification
3
+ module Pre
4
+
5
+ def contribute_to_openapi_verb(verb_defn)
6
+ verb_defn
7
+ end
8
+
9
+ end # module Pre
10
+ module Post
11
+
12
+ def contribute_to_openapi_verb(verb_defn)
13
+ verb_defn
14
+ end
15
+
16
+ end # module Post
17
+ end # class Specification
18
+ end # module Webspicy
@@ -100,6 +100,13 @@ module Webspicy
100
100
  unless ['get', 'options', 'delete', 'head'].include?(verb)
101
101
  verb_defn[:requestBody] = request_body_for(service)
102
102
  end
103
+ verb_defn = service.conditions.inject(verb_defn) do |memo, p|
104
+ if p.respond_to?(:contribute_to_openapi_verb)
105
+ p.contribute_to_openapi_verb(memo)
106
+ else
107
+ memo
108
+ end
109
+ end
103
110
  verbs.merge({ verb => verb_defn })
104
111
  end
105
112
  end
@@ -107,10 +114,15 @@ module Webspicy
107
114
  def request_body_for(service)
108
115
  schema = actual_input_schema(service)
109
116
  example = nil # catch(:unfound) { generator.call(schema, {}) }
117
+ content_type = if service.method.downcase == 'post_form'
118
+ 'application/x-www-form-urlencoded'
119
+ else
120
+ 'application/json'
121
+ end
110
122
  {
111
123
  required: true,
112
124
  content: {
113
- 'application/json' => {
125
+ content_type => {
114
126
  schema: schema.to_json_schema,
115
127
  example: example
116
128
  }.compact
@@ -1 +1,2 @@
1
1
  require_relative 'openapi/generator'
2
+ require_relative 'openapi/ext'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webspicy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.5
4
+ version: 0.21.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-06 00:00:00.000000000 Z
11
+ date: 2023-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -351,6 +351,7 @@ files:
351
351
  - lib/webspicy/web/mocker.rb
352
352
  - lib/webspicy/web/mocker/config.ru
353
353
  - lib/webspicy/web/openapi.rb
354
+ - lib/webspicy/web/openapi/ext.rb
354
355
  - lib/webspicy/web/openapi/generator.rb
355
356
  - lib/webspicy/web/specification.rb
356
357
  - lib/webspicy/web/specification/file_upload.rb