tla-sbuilder 0.1.0 → 0.2.1

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +116 -33
  3. data/VERSION +1 -1
  4. data/lib/cli/cli-customer.rb +41 -23
  5. data/lib/cli/cli-example.rb +1 -1
  6. data/lib/cli/cli-pet.rb +33 -30
  7. data/lib/cli/cli-text.rb +57 -17
  8. data/lib/cli/cli.rb +56 -10
  9. data/lib/sbuilder.rb +3 -1
  10. data/lib/sbuilder/constants.rb +5 -2
  11. data/lib/sbuilder/controller.rb +289 -59
  12. data/lib/sbuilder/default-sbuilder.yaml +25 -3
  13. data/lib/sbuilder/domain.rb +1 -1
  14. data/lib/sbuilder/domain_cardinality.rb +1 -1
  15. data/lib/sbuilder/domain_value.rb +1 -1
  16. data/lib/sbuilder/exception.rb +13 -7
  17. data/lib/sbuilder/extension_loader.rb +75 -18
  18. data/lib/sbuilder/facade/api_loader.rb +293 -0
  19. data/lib/sbuilder/factory.rb +66 -3
  20. data/lib/sbuilder/model.rb +59 -3
  21. data/lib/sbuilder/mustache/template.rb +13 -13
  22. data/lib/sbuilder/mustache/template_reader_context.rb +5 -3
  23. data/lib/sbuilder/param_set.rb +2 -1
  24. data/lib/sbuilder/param_set_db.rb +1 -1
  25. data/lib/sbuilder/param_set_def.rb +1 -1
  26. data/lib/sbuilder/param_set_if.rb +1 -1
  27. data/lib/sbuilder/param_set_loader_swagger.rb +122 -121
  28. data/lib/sbuilder/param_set_step.rb +1 -1
  29. data/lib/sbuilder/parameter.rb +1 -1
  30. data/lib/sbuilder/parameter_container.rb +1 -1
  31. data/lib/sbuilder/parameter_dom.rb +1 -1
  32. data/lib/sbuilder/parameter_ref.rb +2 -2
  33. data/lib/sbuilder/resolver_rule.rb +1 -1
  34. data/lib/sbuilder/resolver_rule_match.rb +1 -1
  35. data/lib/sbuilder/resolver_rule_ref.rb +1 -1
  36. data/lib/sbuilder/spec/README +5 -0
  37. data/lib/sbuilder/spec/api_loader_facade.rb +247 -0
  38. data/lib/utils/cache_lines.rb +21 -0
  39. data/lib/utils/netio.rb +5 -13
  40. data/mustache/cfg/macro_run.mustache +1 -0
  41. data/mustache/interface_processes.mustache +9 -2
  42. data/mustache/interface_stubs_dummy.mustache +7 -0
  43. data/mustache/interface_types.mustache +3 -3
  44. data/mustache/invariant_activate.mustache +16 -0
  45. data/mustache/setup/assumptions_activate.mustache +16 -0
  46. data/mustache/{domains_run.mustache → setup/domains_run.mustache} +2 -2
  47. data/mustache/setup/operator_run.mustache +2 -0
  48. data/mustache/setup/steps_run_bind_set.mustache +1 -1
  49. data/mustache/setup/steps_run_parameterBind.mustache +4 -2
  50. data/mustache/tla/macro_run.mustache +8 -0
  51. data/mustache/tla/operator_run.mustache +1 -0
  52. data/mustache/tla/plc_define_run.mustache +2 -4
  53. data/mustache/tla/plc_run_state.mustache +1 -1
  54. data/src-extend/extend/extend_invariant_cfg.mustache +1 -1
  55. data/src/pet/assumption_domains.tla +1 -1
  56. data/src/pet/correctness.cfg +4 -0
  57. data/tla-sbuilder.gemspec +3 -1
  58. metadata +14 -10
  59. data/lib/sbuilder/param_set_loader.rb +0 -77
  60. data/src-extend/extend_app/correctness.cfg +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7c59bc7c8ccd8cc4c991d487f793208c1234bab
4
- data.tar.gz: 564a18b8c901b8714dfb32c7c70d0a78b5a8f7ac
3
+ metadata.gz: b4731a435e4630bf464dd4d183d3a40df97e1e38
4
+ data.tar.gz: 8c4e8a335e829e7df768069dfb3b276e199f2913
5
5
  SHA512:
6
- metadata.gz: 208032b65aff58ad9a32ae7f4197da74b24979defcf30886bcbcd32974571b34da94c80f027dddea217bfea2a7d71c254aa8b93b06f7f94d80433960818c90dd
7
- data.tar.gz: 667f6dd2647f7e60cb1bfde14f28d55703c57b1b16f3dc33e2fbf1ca7c61d320feb9d51ea89856d544ba48da6f295f2e35b21547e20d9beed63c11ff9985007a
6
+ metadata.gz: 7135b56dc4e078cc4f950402b3245e5bf239ea5718da7fd86c20f48fbdec39d00e06cc93f34fc2a8dfd90e727a5e6e6b9ddb41f212c510c9f604f28cc9a6954c
7
+ data.tar.gz: ad58191062c7e450f97f2e8f51c6deddf1eed8a39378c1775a44770be3dae2708b185340ce7022e194d04edadaac308a4b289999383568381f9ed3895bcfd89a
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  <link href="../site.css" rel="stylesheet"></link>
2
- [Up](../index.php) [Readme](README.html) [Releases](RELEASES.html) [Todo](TODO.html)
2
+ [Readme](README.md) [Releases](RELEASES.md)
3
3
 
4
-
5
- # Sbuilder - A Specification Builder for TLA+ Tools - $Release:0.1.0$
4
+ # Sbuilder - A Specification Builder for TLA+ Tools - $Release:0.2.1$
6
5
 
7
6
  A tool to generate runnable specification models in
8
7
  [TLA+ language](http://research.microsoft.com/en-us/um/people/lamport/tla/book.html)
@@ -12,7 +11,24 @@ verified using
12
11
  and parts of it can be presented as
13
12
  [implementation blueprints](#BLUEPRINT) to developers.
14
13
 
15
- See [live documentation](features.html) for more details.
14
+ See
15
+ [live documentation](http://jarjuk.github.io/tla-sbuilder/0.1.1.pre/features.html)
16
+ for more details on configuring Sbuilder, and on features implemented
17
+ by Sbuilder
18
+
19
+ Blog posts giving background information on Sbuilder:
20
+
21
+ * [Read an article "How Amazon uses formal methods"](https://jarjuk.wordpress.com/2016/03/03/sbuilder-1-problem):
22
+ summarizes experiences Amazon has gained, when using TLA+ tools,
23
+ what kind of benefits we should expect, when using formal methods to
24
+ model business IT
25
+
26
+ * [Sbuilder introduction](https://jarjuk.wordpress.com/2016/03/03/sbuilder-2-intro/):
27
+ mostly the same information as in this README
28
+
29
+ * [Using Sbuilder to Model Business IT Systems](https://jarjuk.wordpress.com/2016/03/03/sbuilder-3-case/):
30
+ a very loooong post demonstrating, how business IT system modeling
31
+ can be done using Sbuilder
16
32
 
17
33
  ## <a id="TARGET-SYSTEM">Target Systems</a>
18
34
 
@@ -36,11 +52,13 @@ architecture identifies
36
52
  Sbuilder combines three main elements to create runnable TLA+
37
53
  specification code:
38
54
 
39
- 1. **Interface specification**: Sbuilder accepts
55
+ 1. **Interface specification**: Natively Sbuilder accepts
40
56
  [RESTfull](https://en.wikipedia.org/wiki/Representational_state_transfer)
41
57
  interface api specification expressed in
42
58
  [Swagger](http://swagger.io/)
43
- [v2.0](http://swagger.io/specification/) format.
59
+ [v2.0](http://swagger.io/specification/) format. Plugin system
60
+ allows importing API confiugration also from external systems,
61
+ e.g. from [salesforce](https://github.com/jarjuk/tla-sbuilder-salesforce)
44
62
 
45
63
  2. **Specification extension**: Sbuilder tangles manually crafted code
46
64
  snippets from Sbuilder *code repository* with the code generated
@@ -48,12 +66,12 @@ specification code:
48
66
  TLA+ language to model behavior and correctness criteria of the
49
67
  target system.
50
68
 
51
- 3. **Setups**: To complete runnable code, Sbuilder uses setups. A
52
- setup is a sequence of interface operations, and their input
53
- parameters. In addition, a setup may define domain cardinalities,
54
- or domain values. The tools allows defining multiple setups, each
55
- setup resulting to a complete, runnable TLA+ code, allowing system
56
- model to be run in various environment context
69
+ 3. **Setups**: To complete runnable code Sbuilder uses setups. A setup
70
+ is a sequence of interface operations, and their input parameters.
71
+ In addition, a setup may define domain cardinalities, or domain
72
+ values. The tools allows defining multiple setups, each setup
73
+ resulting to a complete, runnable TLA+ code, allowing system model
74
+ to be run in various environment context
57
75
 
58
76
  Sbuilder uses following categories to organize *specification
59
77
  snippets* in its **code repository**:
@@ -82,16 +100,15 @@ snippets* in its **code repository**:
82
100
  * **possibility**: optional operator definitions to increase
83
101
  confidence in correctness invariants
84
102
 
85
- * **assumption**: operator definitions, and ASSUME directive in TLA+
86
- language specifying properties, which must be not violated in the
87
- specification code
103
+ * **assumption**: operator definitions, in TLA+ language specifying
104
+ properties on specification model constants, which must be not
105
+ violated.
88
106
 
89
- In order to support IT system application development, as depicted in
90
- section [modeling pipeline](#MODELING-PIPELINE) below, Sbuilder
91
- can generate <a id="BLUEPRINT">**implementation
92
- blueprints**</a>. *Implementation blueprints* are html-pages including
93
- code snippets from Sbuilder *code repository*, or code generated
94
- based on *interface specifications*.
107
+ Sbuilder can generate <a id="BLUEPRINT">**implementation
108
+ blueprints**</a> as depicted in section
109
+ [modeling pipeline](#MODELING-PIPELINE) below. *Implementation
110
+ blueprints* are html-pages including code snippets from Sbuilder *code
111
+ repository*, or code generated based on *interface specifications*.
95
112
 
96
113
 
97
114
  ## <a id="MODELING-PIPELINE">Modeling Pipeline</a>
@@ -105,7 +122,7 @@ the system being built - and thereby to justify the extra effort
105
122
  needed in modeling.
106
123
 
107
124
 
108
- ![process](pics/process.svg)
125
+ ![process](pics/process.jpg)
109
126
 
110
127
  We assume that services are currently implemented based on informal
111
128
  service specification documents written in English. We also assume
@@ -264,7 +281,7 @@ and observing **Error: Evaluating invariant** `possible_tag_with_invalid_address
264
281
 
265
282
  ### Create Own Model
266
283
 
267
- See [live documentation](features.html) for more details.
284
+ See [live documentation](http://jarjuk.github.io/tla-sbuilder/0.1.1.pre/features.html) for more details.
268
285
 
269
286
  Create default directories used by `sbuilder` in current working directory
270
287
 
@@ -291,6 +308,20 @@ To run the model checking for setup `default` using TLA+tools jar in
291
308
  (cd gen/default/tla; java -cp $CP tlc2.TLC setup)
292
309
 
293
310
 
311
+ Create TLA snippets in directory `src`, and include template snippets
312
+ to generated code using
313
+ [mustache syntax](https://mustache.github.io/mustache.5.html).
314
+
315
+ For example, put the following code to
316
+
317
+ at_least_two_tags == Cardinality( v_tags ) > 1
318
+
319
+ file `src/operator_at_least_two_tags.tla`, and include it to
320
+ specification code by adding following line into `src/operator`
321
+
322
+ {{>operator_at_least_two_tags.tla}}
323
+
324
+
294
325
  ## Manage State Space Explosion, and Allow Scaling
295
326
 
296
327
  [State space explosion](https://www.google.fi/search?q=state+space+explosion)
@@ -298,21 +329,24 @@ is inherent problem in
298
329
  [model checking](https://en.wikipedia.org/wiki/Model_checking), the
299
330
  theory behind TLA+ tool.
300
331
 
301
- Sbuilder tries to avoid problems due to state space explosion by
332
+ Sbuilder tries to avoid problems due to state space explosion by
333
+ controlling, how environment invokes interface operations, and in
334
+ effect, by throttling number of states generated during model
335
+ checking.
302
336
 
303
- * allowing controlling, how environment invokes interface operations,
304
- and in effect, throttling number of states generated during model
305
- checking.
337
+ To avoid enumering to0 large sets Sbuilder allows
306
338
 
307
- * allowing to fix input parameter bindings in an interface
308
- operation. In cases, where domain sizes are not a problem, SBuilder
309
- can allow TLA+ tool to explore all possible, or partial, input
310
- parameter combinations during model checking.
339
+ * fixing input parameter bindings in an interface operation. In cases,
340
+ where domain sizes are not a problem, SBuilder allows TLA+ tool to
341
+ use non-deterministic choice for input parameter values.
311
342
 
343
+ * using reduced domain ranges, when checking assumptions on resolved
344
+ domains.
312
345
 
313
346
  In TLA+tools, number of states/sec decreases as specification code
314
- volume increases (see a [benchmark](BENCHMARK.html) results for more
315
- details).
347
+ volume increases (see a
348
+ [benchmark](https://rawgit.com/jarjuk/tla-sbuilder/master/BENCHMARK.html)
349
+ results for more details).
316
350
 
317
351
  SBuilder tries to avoid problems due to increase in specification code
318
352
  by offering run time option `--filter-src`, which parses TLA+ snippets
@@ -322,6 +356,55 @@ option `--filter-list` to continue after parser error, and to
322
356
  configure manually modules call flow analyzer would otherwise omit
323
357
  from the specification code.
324
358
 
359
+ ## Extending Sbuilder
360
+
361
+ Sbuilder defines an extension point to add API loader plugins. An API
362
+ loader is a Ruby class
363
+
364
+ * using [Sbuilder::ApiLoader](lib/sbuilder/facade/api_loader.rb)
365
+ facade to integrate with Sbuilder
366
+
367
+ * satisfying [`api_loader_facade` contract](lib/sbuilder/spec/api_loader_facade.rb)
368
+
369
+ * used as demonstated in [cucumber tests](features/100-plugin-extension/010-api-loader-plugin.feature)
370
+
371
+ For a plugin implementation example, see an Swagger API loader in
372
+ Sbuilder:
373
+
374
+ * [implementation](lib/sbuilder/param_set_loader_swagger.rb)
375
+
376
+ * [rpsec test](spec/sbuilder/param_set_loader_swagger_spec.rb)
377
+
378
+ For example, to activate Sbuilder API loader plugin
379
+ `Sbuilder::Interfaces::Salesforce::SalesforceLoader` implemented in
380
+ `tla-sbuilder-salesforce` Gem using configuration hash shown below,
381
+ add the following YAML snippet to `sbuilder.yaml` configuration file
382
+ sub-section `extend.loaders`:
383
+
384
+ extend:
385
+ loaders:
386
+ - gem: tla-sbuilder-salesforce
387
+ className: Sbuilder::Interfaces::Salesforce::SalesforceLoader
388
+ configuration:
389
+ client_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxdaYTBJBssnuS0bvkraFcSSlC9EQZngf97yspdbh8iV_EV
390
+ client_secret: xxxxxxxxxx476009913
391
+ username: xxxxxxxev@gmail.com
392
+ password: 'xxxxxxxx'
393
+ security_token: 'xxxxxxxxxxVnEZjYP9cUZix9'
394
+
395
+ API instances are configured using entries referring plugin
396
+ `className` in `sbuilder.yaml` `interfaces` array. For example, the
397
+ entry for an Salesforce API instance entry.
398
+
399
+ interfaces:
400
+ - className: Sbuilder::Interfaces::Salesforce::SalesforceLoader
401
+ file: salesforce-api.yaml
402
+ cache: sf
403
+
404
+ In the example, `file` -property points to a plugin configuration
405
+ file, and `cache` property gives name prefix for files, which the
406
+ plugin may use to cache API content to speed up generation phase.
407
+
325
408
 
326
409
  ## License
327
410
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.1
@@ -13,24 +13,34 @@ module Sbuilder
13
13
 
14
14
 
15
15
  FILE_EXTENSIONS_CUSTOMER_COMMON="extend_customer_doms.yaml"
16
+ FILE_EXTENSIONS_CUSTOMER_IF="extend_customer_if.yaml"
16
17
  FILE_EXTENSIONS_CUSTOMER_RUN1="extend_customer_run1.yaml"
17
18
  FILE_EXTENSIONS_CUSTOMER_RUN2="extend_customer_run2.yaml"
18
19
 
19
- SBUILDER_YAML_CUSTOMER= <<-EOS
20
+ SBUILDER_YAML_CUSTOMER= <<-EOS.unindent
21
+
22
+ # ------------------------------------------------------------------
23
+ #{Sbuilder::CliText::SBUILDER_PREFERENCES}
24
+ preferences:
25
+ debug-output: true
26
+
27
+ # ------------------------------------------------------------------
28
+ #{Sbuilder::CliText::SBUILDER_EXTENSION}
29
+
20
30
 
21
31
  # ------------------------------------------------------------------
22
32
  #{Sbuilder::CliText::SBUILBER_INTERFACES}
23
33
 
24
34
  interfaces:
25
- - type: swagger
35
+ -
36
+ className: Sbuilder::ParamSetLoaderSwagger
26
37
  file: #{FILE_INTERFACE_CUSTOMER}
27
38
 
28
39
 
29
40
  # ------------------------------------------------------------------
30
41
  #{Sbuilder::CliText::SBUILDER_RESOLVERS}
31
42
  resolvers:
32
- - type: resolver_yaml
33
- file: #{FILE_RESOLVER_CUSTOMER}
43
+ - file: #{FILE_RESOLVER_CUSTOMER}
34
44
 
35
45
  # ------------------------------------------------------------------
36
46
  #{Sbuilder::CliText::SBUILER_SETUPS}
@@ -39,34 +49,32 @@ module Sbuilder
39
49
 
40
50
  - setupDirectory: customer1
41
51
  extensions:
42
- - type: default-yaml
43
- url: cnf/#{FILE_EXTENSIONS_CUSTOMER_COMMON}
44
- - type: default-yaml
45
- url: cnf/#{FILE_EXTENSIONS_CUSTOMER_RUN1}
52
+ - url: cnf/#{FILE_EXTENSIONS_CUSTOMER_COMMON}
53
+ - url: cnf/#{FILE_EXTENSIONS_CUSTOMER_IF}
54
+ - url: cnf/#{FILE_EXTENSIONS_CUSTOMER_RUN1}
46
55
 
47
56
  - setupDirectory: customer2
48
57
  extensions:
49
- - type: default-yaml
50
- url: cnf/#{FILE_EXTENSIONS_CUSTOMER_COMMON}
51
- - type: default-yaml
52
- url: cnf/#{FILE_EXTENSIONS_CUSTOMER_RUN2}
58
+ - url: cnf/#{FILE_EXTENSIONS_CUSTOMER_COMMON}
59
+ - url: cnf/#{FILE_EXTENSIONS_CUSTOMER_IF}
60
+ - url: cnf/#{FILE_EXTENSIONS_CUSTOMER_RUN2}
53
61
 
54
62
  # ------------------------------------------------------------------
55
- #{Sbuilder::CliText::SBUILDER_PREFERENCES}
56
- preferences:
57
- debug-output: true
58
63
 
59
- # ------------------------------------------------------------------
60
64
  #{Sbuilder::CliText::SBUILDER_GENERATE}
61
65
 
62
66
 
63
- EOS
67
+ # ------------------------------------------------------------------
64
68
 
65
-
69
+ #{Sbuilder::CliText::SBUILDER_INVARIANTS}
70
+ invariants:
71
+ # - Invariant1: Add TLA operator definition Invariant1 and uncomment this line
66
72
 
67
73
 
74
+ EOS
68
75
 
69
- EXTENSIONS_CUSTOMER_COMMON = <<-EOS
76
+
77
+ EXTENSIONS_CUSTOMER_COMMON = <<-EOS.unindent
70
78
  #{Sbuilder::CliText::EXTENSION_HEADER_DOM}
71
79
  #
72
80
  #
@@ -87,7 +95,17 @@ module Sbuilder
87
95
 
88
96
  EOS
89
97
 
90
- EXTENSIONS_CUSTOMER_RUN1 = <<-EOS
98
+ EXTENSIONS_CUSTOMER_IF = <<-EOS.unindent
99
+ #{Sbuilder::CliText::EXTENSION_HEADER_IF}
100
+ #
101
+ # Exampl uses dummy process, which should be replaced with real implementation
102
+ - interface-extension:
103
+ - matcher: /customers(post)
104
+ implementation: dummy
105
+ EOS
106
+
107
+
108
+ EXTENSIONS_CUSTOMER_RUN1 = <<-EOS.unindent
91
109
  #{Sbuilder::CliText::EXTENSION_HEADER_SETUP}
92
110
  #
93
111
  # Extend domain resolved in #{FILE_RESOLVER_CUSTOMER}
@@ -175,7 +193,7 @@ module Sbuilder
175
193
 
176
194
  EOS
177
195
 
178
- EXTENSIONS_CUSTOMER_RUN2 = <<-EOS
196
+ EXTENSIONS_CUSTOMER_RUN2 = <<-EOS.unindent
179
197
  #{Sbuilder::CliText::EXTENSION_HEADER_SETUP}
180
198
  #
181
199
  #
@@ -205,7 +223,7 @@ module Sbuilder
205
223
 
206
224
 
207
225
 
208
- RESOLVER_CUSTOMER = <<-EOS
226
+ RESOLVER_CUSTOMER = <<-EOS.unindent
209
227
  #{Sbuilder::CliText::RESOLVER_HEADER}
210
228
  #
211
229
  # Example mapper for customer interface
@@ -281,7 +299,7 @@ module Sbuilder
281
299
  EOS
282
300
 
283
301
 
284
- INTERFACE_CUSTOMER_SWAGGER = <<-EOS
302
+ INTERFACE_CUSTOMER_SWAGGER = <<-EOS.unindent
285
303
  # Example YAML configuration file
286
304
  #
287
305
  swagger: "2.0"
@@ -21,7 +21,6 @@ module Sbuilder
21
21
  CliPet.write_files( dir, self )
22
22
  # sbuilder - example sources
23
23
  write_example_dir
24
-
25
24
  end
26
25
 
27
26
  desc :customer, "Create 'Customer' TLA+ model <cnf_dir> -directory"
@@ -35,6 +34,7 @@ module Sbuilder
35
34
  write_example( dir, Sbuilder::CliCustomer::FILE_RESOLVER_CUSTOMER, Sbuilder::CliCustomer::RESOLVER_CUSTOMER )
36
35
  write_example( dir, Sbuilder::CliCustomer::FILE_INTERFACE_CUSTOMER, Sbuilder::CliCustomer::INTERFACE_CUSTOMER_SWAGGER )
37
36
  write_example( dir, Sbuilder::CliCustomer::FILE_EXTENSIONS_CUSTOMER_COMMON, Sbuilder::CliCustomer::EXTENSIONS_CUSTOMER_COMMON )
37
+ write_example( dir, Sbuilder::CliCustomer::FILE_EXTENSIONS_CUSTOMER_IF, Sbuilder::CliCustomer::EXTENSIONS_CUSTOMER_IF )
38
38
  write_example( dir, Sbuilder::CliCustomer::FILE_EXTENSIONS_CUSTOMER_RUN1, Sbuilder::CliCustomer::EXTENSIONS_CUSTOMER_RUN1 )
39
39
  write_example( dir, Sbuilder::CliCustomer::FILE_EXTENSIONS_CUSTOMER_RUN2, Sbuilder::CliCustomer::EXTENSIONS_CUSTOMER_RUN2 )
40
40
 
@@ -28,14 +28,14 @@ module Sbuilder
28
28
 
29
29
  interfaces:
30
30
 
31
- - type: swagger
31
+ - className: Sbuilder::ParamSetLoaderSwagger
32
32
  url: #{PETSTORE_URL}
33
33
  cache: petstore.yaml
34
34
 
35
- - type: swagger
35
+ - className: Sbuilder::ParamSetLoaderSwagger
36
36
  file: #{FILE_INTERFACE_TAGS}
37
37
 
38
- - type: swagger
38
+ - className: Sbuilder::ParamSetLoaderSwagger
39
39
  infrastructureServices: true
40
40
  file: #{FILE_INFRASTRUCTURE_PETSTORE}
41
41
 
@@ -43,8 +43,7 @@ module Sbuilder
43
43
  # ------------------------------------------------------------------
44
44
  #{Sbuilder::CliText::SBUILDER_RESOLVERS}
45
45
  resolvers:
46
- - type: resolver_yaml
47
- url: cnf/#{FILE_RESOLVER_PETSTORE}
46
+ - url: cnf/#{FILE_RESOLVER_PETSTORE}
48
47
  # un-comment to use default resolver.
49
48
  # normally not used
50
49
  # - type: resolver_yaml
@@ -54,50 +53,46 @@ module Sbuilder
54
53
  #{Sbuilder::CliText::SBUILER_SETUPS}
55
54
  setups:
56
55
  - setupDirectory: default
57
-
56
+ desc: Validate assumptions
57
+ assumptions:
58
+ - Assume_Address_Domains
59
+ - Assume_Id_Domains
60
+ - Assume_Tag_Domains
61
+ - Assume_Owner_Domains
62
+ - Assume_Pet_Domains
58
63
  - setupDirectory: pet1
59
64
  extensions:
60
- - type: default-yaml
61
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
62
- - type: default-yaml
63
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN1}
65
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
66
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN1}
64
67
  possibilities:
65
68
  - tag_with_invalid_address
66
69
  - at_least_two_tags
67
70
 
68
71
  - setupDirectory: pet2
69
72
  extensions:
70
- - type: default-yaml
71
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
72
- - type: default-yaml
73
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN2}
73
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
74
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN2}
74
75
 
75
76
  - setupDirectory: pet3
76
77
  extensions:
77
- - type: default-yaml
78
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
79
- - type: default-yaml
80
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN3}
78
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
79
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN3}
81
80
  possibilities:
82
81
  - tag_with_invalid_address
83
82
  - at_least_two_tags
84
83
 
85
84
  - setupDirectory: pet-svg
86
85
  extensions:
87
- - type: default-yaml
88
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
89
- - type: default-yaml
90
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN_SVG}
86
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
87
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN_SVG}
91
88
 
92
89
  - setupDirectory: error-invalidate-name
93
90
  desc: Owner name is invalidate on a tag referenced
94
91
  preferences:
95
92
  error-invalidate-name: true
96
93
  extensions:
97
- - type: default-yaml
98
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
99
- - type: default-yaml
100
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN3}
94
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
95
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN3}
101
96
 
102
97
 
103
98
  - setupDirectory: error-duplicate-tag
@@ -105,10 +100,8 @@ module Sbuilder
105
100
  preferences:
106
101
  error-duplicate-tag: true
107
102
  extensions:
108
- - type: default-yaml
109
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
110
- - type: default-yaml
111
- url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN3}
103
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_COMMON}
104
+ - url: cnf/#{FILE_EXTENSIONS_PETSTORE_RUN3}
112
105
 
113
106
 
114
107
  # ------------------------------------------------------------------
@@ -294,6 +287,16 @@ module Sbuilder
294
287
  # include: definition_types.mustache
295
288
 
296
289
 
290
+ #{Sbuilder::CliText::SBUILDER_INVARIANTS}
291
+ invariants:
292
+ - ValidatePets: All pet entries are valid
293
+ - UniquePet: Pet id is unique
294
+ - UniqueTag: Tag id is unique
295
+ - ValidReferecendTag: For all pets there exists a unique, valid tag entry.
296
+ - CoherentOwnerAddress: Address on all tags with the same ower are equal
297
+ - Pets_TypeInvariant: Type invariant Pet
298
+ - Tags_TypeInvariant: Type invariant Tag
299
+
297
300
  EOS
298
301
 
299
302
  EXTENSIONS_PETSTORE_COMMON = <<-EOS