@@ -472,6 +472,18 @@ my.org.User
472
472
` ` ` json
473
473
"components": {
474
474
"schemas": {
475
+ "GeneralError": {
476
+ "type": "object",
477
+ "properties": {
478
+ "code": {
479
+ "type": "integer",
480
+ "format": "int32"
481
+ },
482
+ "message": {
483
+ "type": "string"
484
+ }
485
+ }
486
+ },
475
487
"Category": {
476
488
"type": "object",
477
489
"properties": {
@@ -562,6 +574,14 @@ my.org.User
562
574
` ` ` yaml
563
575
components:
564
576
schemas:
577
+ GeneralError:
578
+ type: object
579
+ properties:
580
+ code:
581
+ type: integer
582
+ format: int32
583
+ message:
584
+ type: string
565
585
Category:
566
586
type: object
567
587
properties:
@@ -1903,65 +1923,74 @@ In all cases, the example value is expected to be compatible with the type schem
1903
1923
of its associated value. Tooling implementations MAY choose to
1904
1924
validate compatibility automatically, and reject the example value(s) if incompatible.
1905
1925
1906
- # #### Example Object Example
1926
+ # #### Example Object Examples
1927
+
1928
+ In a model :
1907
1929
1908
1930
` ` ` yaml
1909
- # in a model
1910
1931
schemas:
1911
1932
properties:
1912
1933
name:
1913
1934
type: string
1914
1935
examples:
1915
1936
name:
1916
1937
$ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
1938
+ ` ` `
1917
1939
1918
- # in a request body:
1919
- requestBody:
1920
- content:
1921
- 'application/json':
1922
- schema:
1923
- $ref: '#/components/schemas/Address'
1924
- examples:
1925
- foo:
1926
- summary: A foo example
1927
- value: {"foo": "bar"}
1928
- bar:
1929
- summary: A bar example
1930
- value: {"bar": "baz"}
1931
- 'application/xml':
1932
- examples:
1933
- xmlExample:
1934
- summary: This is an example in XML
1935
- externalValue: 'http://example.org/examples/address-example.xml'
1936
- 'text/plain':
1937
- examples:
1938
- textExample:
1939
- summary: This is a text example
1940
- externalValue: 'http://foo.bar/examples/address-example.txt'
1941
-
1940
+ In a request body :
1942
1941
1943
- # in a parameter
1944
- parameters :
1945
- - name: 'zipCode'
1946
- in: 'query'
1942
+ ` ` ` yaml
1943
+ requestBody :
1944
+ content:
1945
+ 'application/json':
1947
1946
schema:
1948
- type: 'string'
1949
- format: 'zip-code'
1950
- examples:
1951
- zip-example:
1952
- $ref: '#/components/examples/zip-example'
1947
+ $ref: '#/components/schemas/Address'
1948
+ examples:
1949
+ foo:
1950
+ summary: A foo example
1951
+ value: {"foo": "bar"}
1952
+ bar:
1953
+ summary: A bar example
1954
+ value: {"bar": "baz"}
1955
+ 'application/xml':
1956
+ examples:
1957
+ xmlExample:
1958
+ summary: This is an example in XML
1959
+ externalValue: 'http://example.org/examples/address-example.xml'
1960
+ 'text/plain':
1961
+ examples:
1962
+ textExample:
1963
+ summary: This is a text example
1964
+ externalValue: 'http://foo.bar/examples/address-example.txt'
1965
+ ` ` `
1953
1966
1954
- # in a response
1955
- responses:
1956
- '200':
1957
- description: your car appointment has been booked
1958
- content:
1959
- application/json:
1960
- schema:
1961
- $ref: '#/components/schemas/SuccessResponse'
1962
- examples:
1963
- confirmation-success:
1964
- $ref: '#/components/examples/confirmation-success'
1967
+ In a parameter :
1968
+
1969
+ ` ` ` yaml
1970
+ parameters:
1971
+ - name: 'zipCode'
1972
+ in: 'query'
1973
+ schema:
1974
+ type: 'string'
1975
+ format: 'zip-code'
1976
+ examples:
1977
+ zip-example:
1978
+ $ref: '#/components/examples/zip-example'
1979
+ ` ` `
1980
+
1981
+ In a response :
1982
+
1983
+ ` ` ` yaml
1984
+ responses:
1985
+ '200':
1986
+ description: your car appointment has been booked
1987
+ content:
1988
+ application/json:
1989
+ schema:
1990
+ $ref: '#/components/schemas/SuccessResponse'
1991
+ examples:
1992
+ confirmation-success:
1993
+ $ref: '#/components/examples/confirmation-success'
1965
1994
` ` `
1966
1995
1967
1996
0 commit comments