Skip to content

Commit 296d4cd

Browse files
Updating dictionary documentation
1 parent 469745c commit 296d4cd

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

documentation/dictionary.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ nav_order: 8
2727
- [Making Requests](#making-requests)
2828
- [Dictionary with Examples](#dictionary-with-examples)
2929

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.
3131

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.
3333

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.
3535

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.
3737

3838
## Structure
3939

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.
4141
- Each entry in the dictionary maps a schema field to either a `single value` or a `list of values`.
4242
- 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.
4444

4545
### Basic Field Mapping
4646

@@ -224,7 +224,7 @@ Employee:
224224

225225
### Referencing Other Schemas
226226

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/>
228228
For example, given the following `Employee` and `Address` schemas:
229229

230230
```yaml
@@ -272,15 +272,15 @@ Address:
272272
```
273273
{% endtab %}
274274
{% 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.
276276

277277
## Dictionary Generation
278278
{: .d-inline-block }
279279

280280
Commercial
281281
{: .label }
282282

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.
284284

285285
{: .note}
286286
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

Comments
 (0)