You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/dictionary.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -27,20 +27,20 @@ nav_order: 8
27
27
-[Making Requests](#making-requests)
28
28
-[Dictionary with Examples](#dictionary-with-examples)
29
29
30
-
When Specmatic is required to generate requests for tests or responses for stubs and cannot locate any examples, it will create them utilizing the structure and keys outlined in the OpenAPI specifications.
30
+
When Specmatic generates requests while running tests or responses while running as a stub and no examples have been provided, Specmatic will generate them based on the schema in the OpenAPI specifications.
31
31
32
-
It will fill the structure with random values based on the defined schema. Although the generated values will conform to the schema, they will not contain meaningful values that reflect the context of your business domain.
32
+
While the generated values will conform to the schema, they may not be meaningful from the point of view of your business domain.
33
33
34
-
The dictionary offers a method to retrieve domain-specific values in the absence of examples. You can provide a dictionary of values to Specmatic, which will utilize this dictionary as a reference when generating requests or responses.
34
+
This is where dictionary capability helps you define domain-specific values which Specmatic can use in the absence of examples. Specmatic will lookup values for fields in the ditionary defined by you while generating requests or responses.
35
35
36
-
The dictionary can be supplied in either `YAML` or `JSON` format and should adhere to the naming convention of `<spec-file-name>_dictionary.<format>` for ease of use.
36
+
The dictionary can be supplied in either `YAML` or `JSON` format. When the dictionary file name follows the convention `<spec-file-name>_dictionary.<format>`, Specmatic will automatically pick it up in the context of the corresponding API specification file.
37
37
38
38
## Structure
39
39
40
-
The dictionary utilizes a standard JSON format, where fields are represented as nested properties that reflect the hierarchical structure of the schema.
40
+
Fields are represented as nested properties that reflect the hierarchical structure of the schema.
41
41
- Each entry in the dictionary maps a schema field to either a `single value` or a `list of values`.
42
42
- If a single value is specified, it will be used directly.
43
-
- If a list is specified, one value will be `pseudo-randomly`selected.
43
+
- If a list is specified, one of those values will be selected at random.
44
44
45
45
### Basic Field Mapping
46
46
@@ -224,7 +224,7 @@ Employee:
224
224
225
225
### Referencing Other Schemas
226
226
227
-
When a schema utilizes `$ref` to reference another schema, the dictionary directly accesses the fields of the referenced schema.<br/>
227
+
When a schema component utilizes `$ref` to reference another schema component, the dictionary for the referenced schema component with be defined with that schema component as the root entry (in other words directly start with the fields of the referenced schema)<br/>
228
228
For example, given the following `Employee` and `Address` schemas:
229
229
230
230
```yaml
@@ -272,15 +272,15 @@ Address:
272
272
```
273
273
{% endtab %}
274
274
{% endtabs %}
275
-
Notice that the keys begin with `Address` instead than `Employee`, because the dictionary accesses the fields from the referenced schema.
275
+
Notice that the keys begin with `Address` instead than `Employee`, because the dictionary accesses the fields from the referenced schema. This makes for convenient dictionary definition withouth have to nest the values deeply.
276
276
277
277
## Dictionary Generation
278
278
{: .d-inline-block }
279
279
280
280
Commercial
281
281
{: .label }
282
282
283
-
Manually creating a dictionary can be a laborious process; therefore, [specmatic-openapi](https://hub.docker.com/r/znsio/specmatic-openapi) offers a convenient method to generate dictionaries from OpenAPI specifications and existing examples.
283
+
Manually creating a dictionary can be quite an involved process, especially when the schema is complex. This is where, [specmatic-openapi](https://hub.docker.com/r/znsio/specmatic-openapi) offers a convenient method to generate dictionaries from OpenAPI specifications and existing examples.
284
284
285
285
{: .note}
286
286
Automated dictionary generation is only available in the commercial version of Specmatic. For further details, please check the [pricing page](https://specmatic.io/pricing).
0 commit comments