paradocs 1.1.2 → 1.1.3

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
  SHA1:
3
- metadata.gz: 5dc965cce0c862cdc35b68bbf6be48418885c69b
4
- data.tar.gz: a0763156554745078e092b79be02d4103b906b77
3
+ metadata.gz: add6d55cad7f9a56bb95f6efe094afa0d9009109
4
+ data.tar.gz: 8c52dfc657dfb97a301f31567327e66c0dae9577
5
5
  SHA512:
6
- metadata.gz: 6664235a1e30f28196a1e58c1826ec7ff22f33b10db0275998ea21eed1dbfb7f17d76de8b9d75f3a57ba0621bf309874a3d0bb2ba099b2527228bfe777ffb68c
7
- data.tar.gz: 6d2658f064f28a80f148f7ababe14bb5dafdd65a46a84a3c9786cb9413d65bc6480cc4bef8c7d8cf6b8e7e52cb7f2868d53e0df40c7e1cbb265909b9f4b34876
6
+ metadata.gz: c042f2d0738aee92991e86fc8a98df7649c6a0bf6c383e50c0f8e69e1237293950aad9fd7aef6b61bfef76ed2348ae6631161c20ce2f44995c23b4bd65cbd444
7
+ data.tar.gz: 3b9ae5c9de08aa07caa7b77a0064151c221d6bfe76b1c3b62e063963ec39028dd76426744b10286ce713c68818395c466686b1111551b1c0caf7ddd497a421ee
@@ -32,5 +32,13 @@ module Paradocs
32
32
  def length(opts)
33
33
  policy :length, opts
34
34
  end
35
+
36
+ def description(text)
37
+ meta description: text
38
+ end
39
+
40
+ def example(value)
41
+ meta example: value
42
+ end
35
43
  end
36
44
  end
@@ -1,3 +1,3 @@
1
1
  module Paradocs
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
@@ -19,7 +19,7 @@ describe Paradocs::Extensions::Structure do
19
19
 
20
20
  field(:data).type(:object).present.schema do
21
21
  field(:id).type(:integer).present.policy(:policy_with_error)
22
- field(:name).type(:string).meta(label: "very important staff")
22
+ field(:name).type(:string).meta(label: "very important staff").description("Example description").example("John")
23
23
  field(:role).type(:string).declared.options(["admin", "user"]).default("user").mutates_schema! do |*|
24
24
  :test_subschema
25
25
  end
@@ -75,6 +75,8 @@ describe Paradocs::Extensions::Structure do
75
75
  expect(data_structure[:name]).to eq({
76
76
  type: :string,
77
77
  label: "very important staff",
78
+ description: "Example description",
79
+ example: "John",
78
80
  mutates_schema: true,
79
81
  block_works: true,
80
82
  json_path: "$.data.name",
@@ -140,6 +142,8 @@ describe Paradocs::Extensions::Structure do
140
142
  type: :string,
141
143
  json_path: "$.data.name",
142
144
  label: "very important staff",
145
+ description: "Example description",
146
+ example: "John",
143
147
  mutates_schema: true
144
148
  },
145
149
  "data.role" => {
@@ -177,7 +181,7 @@ describe Paradocs::Extensions::Structure do
177
181
  _errors: [ArgumentError],
178
182
  "data" => {type: :object, required: true, present: true, json_path: "$.data"},
179
183
  "data.id" => {type: :integer, required: true, present: true, policy_with_error: {errors: [ArgumentError]}, json_path: "$.data.id"},
180
- "data.name" => {type: :string, label: "very important staff", json_path: "$.data.name", mutates_schema: true},
184
+ "data.name" => {type: :string, label: "very important staff", json_path: "$.data.name", mutates_schema: true, description: "Example description", example: "John"},
181
185
  "data.role" => {type: :string, options: ["admin", "user"], default: "user", json_path: "$.data.role", mutates_schema: true},
182
186
  "data.extra" => {type: :array, required: true, json_path: "$.data.extra[]"},
183
187
  "data.extra.extra" => {default: false, policy_with_silent_error: {errors: []}, json_path: "$.data.extra[].extra"},
@@ -187,7 +191,7 @@ describe Paradocs::Extensions::Structure do
187
191
  _errors: [ArgumentError],
188
192
  "data" => {type: :object, required: true, present: true, json_path: "$.data"},
189
193
  "data.id" => {type: :integer, required: true, present: true, policy_with_error: {errors: [ArgumentError]}, json_path: "$.data.id"},
190
- "data.name" => {type: :string, label: "very important staff", json_path: "$.data.name", mutates_schema: true},
194
+ "data.name" => {type: :string, label: "very important staff", json_path: "$.data.name", mutates_schema: true, description: "Example description", example: "John"},
191
195
  "data.role" => {type: :string, options: ["admin", "user"], default: "user", json_path: "$.data.role", mutates_schema: true},
192
196
  "data.extra" => {type: :array, required: true, json_path: "$.data.extra[]"},
193
197
  "data.extra.extra" => {default: false, policy_with_silent_error: {errors: []}, json_path: "$.data.extra[].extra"},
@@ -212,7 +216,7 @@ describe Paradocs::Extensions::Structure do
212
216
  "role" => {type: :string, options: ["admin", "user"], default: "user", json_path: "$.data.role", nested_name: "data.role", mutates_schema: true},
213
217
  "test_field" => {required: true, present: true, json_path: "$.data.test_field", nested_name: "data.test_field"},
214
218
  "id" => {type: :integer, required: true, present: true, policy_with_error: {errors: [ArgumentError]}, json_path: "$.data.id", nested_name: "data.id"},
215
- "name" => {type: :string, label: "very important staff", json_path: "$.data.name", mutates_schema: true, nested_name: "data.name"},
219
+ "name" => {type: :string, label: "very important staff", json_path: "$.data.name", mutates_schema: true, nested_name: "data.name", description: "Example description", example: "John"},
216
220
  "extra" => {
217
221
  type: :array, required: true, json_path: "$.data.extra[]", nested_name: "data.extra",
218
222
  structure: {"extra" => {default: false, policy_with_silent_error: {errors: []}, json_path: "$.data.extra[].extra", nested_name: "data.extra.extra"}}
@@ -232,7 +236,7 @@ describe Paradocs::Extensions::Structure do
232
236
  "role" => {type: :string, options: ["admin", "user"], default: "user", json_path: "$.data.role", nested_name: "data.role", mutates_schema: true},
233
237
  "test1" => {required: true, present: true, json_path: "$.data.test1", nested_name: "data.test1"},
234
238
  "id" => {type: :integer, required: true, present: true, policy_with_error: {errors: [ArgumentError]}, json_path: "$.data.id", nested_name: "data.id"},
235
- "name" => {type: :string, label: "very important staff", json_path: "$.data.name", mutates_schema: true, nested_name: "data.name"},
239
+ "name" => {type: :string, label: "very important staff", json_path: "$.data.name", mutates_schema: true, nested_name: "data.name", description: "Example description", example: "John"},
236
240
  "extra" => {
237
241
  type: :array, required: true, json_path: "$.data.extra[]", nested_name: "data.extra",
238
242
  structure: {"extra" => {default: false, policy_with_silent_error: {errors: []}, json_path: "$.data.extra[].extra", nested_name: "data.extra.extra"}}}
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Paradocs::Field do
4
- let(:context) { Paradocs::Context.new }
4
+ let(:context) { Paradocs::Context.new }
5
5
 
6
6
  subject { described_class.new(:a_key) }
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paradocs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Tkachenko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-09-11 00:00:00.000000000 Z
12
+ date: 2020-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler