Skip to content

Commit c811324

Browse files
Fix anyOf types in PropertyShapeDocument (#19)
* chore(models): add SE-19500 model * fix: property shape document renders anyOf as complex * Delete home.md * Delete exchange.json * test: add test cases * 4.2.9 * chore(deps): regenerate package-lock.json
1 parent fb799c4 commit c811324

24 files changed

+512
-18
lines changed

demo/SE-19500/SE-19500.raml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#%RAML 1.0
2+
title: canda-mule4-example
3+
documentation:
4+
- title: Home
5+
content: !include docs/home.md
6+
version: api
7+
baseUri: https://mule-worker-internal-canda-mule4-example-deve.de-c1.cloudhub.io:33443/api
8+
9+
uses:
10+
candaCommons: modules/canada-commons/canda-commons.raml
11+
myTypes: modules/canda-mule4-example-data-types/api.raml
12+
13+
securedBy: [candaCommons.basicAuth]
14+
15+
types:
16+
Companies: !include ref/companies-schema.json
17+
18+
/greetings:
19+
description: The greetings resource contains only a simple message. The message text might be customized by passing a query parameter.
20+
is: [ candaCommons.client-id-required ]
21+
get:
22+
description: Answers a collection of three simple greetings.
23+
responses:
24+
200:
25+
body:
26+
application/json:
27+
example: !include modules/canda-mule4-example-data-types/examples/greetings-example.json
28+
type: myTypes.greetings
29+
204:
30+
description: The response does not contain any content.
31+
put:
32+
description: Creates a representation of a simple greeting message. This is a pseudo operation, the API does not store the representation in any way.
33+
body:
34+
application/json:
35+
examples:
36+
example1: !include modules/canda-mule4-example-data-types/examples/greeting-example.json
37+
type: myTypes.greeting
38+
responses:
39+
201:
40+
body:
41+
application/json:
42+
example: !include modules/canda-mule4-example-data-types/examples/greeting-example.json
43+
type: myTypes.greeting
44+
/{name}:
45+
description: Responds with a greeting a for the given 'name'.
46+
is: [ candaCommons.client-id-required ]
47+
uriParameters:
48+
name:
49+
type: string
50+
example: "mike"
51+
get:
52+
description: Answers a greeting representation for the given 'name'.
53+
queryParameters:
54+
message:
55+
displayName: message
56+
type: string
57+
description: Pass a message which should be used by the response.
58+
required: false
59+
example: "Hi, Dude"
60+
responses:
61+
200:
62+
body:
63+
application/json:
64+
example: !include modules/canda-mule4-example-data-types/examples/greeting-example.json
65+
type: myTypes.greeting
66+
/companies:
67+
description: The companies resource is probably the most simple representation of a C&A company.
68+
is: [ candaCommons.client-id-required ]
69+
get:
70+
description: Answers a collection (1..n) of all available Companies with their basic attributes.
71+
responses:
72+
200:
73+
body:
74+
application/json:
75+
example: !include ref/companies-example.json
76+
type: !include ref/companies-schema.json
77+
204:
78+
description: The response does not contain any content.
79+
post:
80+
description: Add a new company
81+
body:
82+
application/json:
83+
examples:
84+
example1: !include ref/companies-example.json
85+
type: Companies
86+
responses:
87+
201:
88+
description: Created
89+
90+
/logLevels/{loggerName}:
91+
type: candaCommons.logLevel
92+
is: [ candaCommons.client-id-required ]
93+
/ping:
94+
type: candaCommons.ping
95+
is: [ candaCommons.client-id-required ]
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#%RAML 1.0 Library
2+
usage: |
3+
This library defines some common concepts to be used throughout C&A's API specifications.
4+
5+
traits:
6+
client-id-required:
7+
usage: Apply this trait to every API/resource that is protected by "client-id enforcement".
8+
description: Access requires client credentials (ID and secret).
9+
10+
resourceTypes:
11+
ping:
12+
description: Answers a little JSON structure containing the most essential information on the application in question.
13+
get:
14+
responses:
15+
200:
16+
body:
17+
application/json:
18+
example: !include ref/ping-example.json
19+
type: !include ref/ping-schema.json
20+
logLevel:
21+
description: Change the severity of a specific logger.
22+
uriParameters:
23+
loggerName:
24+
description: Name of the logger whose level is to be changed.
25+
type: string
26+
required: true
27+
example: "org.apache"
28+
put:
29+
body:
30+
application/json:
31+
example: !include ref/log-levels-example.json
32+
type: !include ref/log-levels-schema.json
33+
responses:
34+
200:
35+
body:
36+
application/json:
37+
description: |
38+
Add
39+
"#[com.canda.mulestac.logging.ChangeLogLevel.changeWithJson(flowVars.loggerName, payload)]"
40+
to your generated set-payload flow element.
41+
example: !include ref/log-levels-response-example.json
42+
type: !include ref/log-levels-response-schema.json
43+
44+
securitySchemes:
45+
basicAuth:
46+
displayName: Basic Authentication
47+
description: This API supports Basic Authentication. The client has to provide an "Authorization" header with valid credentials.
48+
type: Basic Authentication
49+
50+
describedBy:
51+
headers:
52+
Authorization:
53+
description: Used to send valid credentials.
54+
type: string
55+
example: Basic ax5Gdza5OnJpZnG4Z2ok
56+
responses:
57+
401:
58+
description: Credentials are missing or could not be validated by the server.
59+
60+
annotationTypes:
61+
deprecated:
62+
type: string
63+
description: Mark resources or methods that should not be used any longer accordingly.
64+
allowedTargets: [ Resource, Method ]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"newLevel": "DEBUG"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"message" : "TODO you need to replace this generated setpayload by #[com.canda.mulestac.logging.ChangeLogLevel.changeWithJson(flowVars.loggerName, payload)] in the api.xml"
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"properties": {
5+
"message": {
6+
"description":"the human readable result of the changeLogLevel operation.",
7+
"type": "string"
8+
}
9+
}
10+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"title": "change a certain log level",
5+
"properties": {
6+
"newLevel": {
7+
"type": "string",
8+
"description": "The new log level to be set.",
9+
"enum": [
10+
"OFF",
11+
"ERROR",
12+
"WARN",
13+
"INFO",
14+
"DEBUG",
15+
"TRACE"
16+
]
17+
},
18+
"createFlag": {
19+
"description": "Optional parameter to create a logger in case it does not exist (to avoid typo errors for existing loggers).",
20+
"type": "boolean"
21+
},
22+
"hoursToReset": {
23+
"description": "Delay in hours after which time the logger is set back to its original log level.",
24+
"type": "integer"
25+
}
26+
},
27+
"required": [
28+
"newLevel"
29+
]
30+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"application": {
3+
"name": "some-application-system",
4+
"version": "2019.8.1",
5+
"stage": "deve"
6+
}
7+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"title": "Describes a /ping response that provides meta information of the application in place.",
5+
"required": [
6+
"application"
7+
],
8+
"properties": {
9+
"application": {
10+
"type": "object",
11+
"description": "The application object holds some basic information concerning self.",
12+
"required": [
13+
"name",
14+
"version",
15+
"stage"
16+
],
17+
"properties": {
18+
"name": {
19+
"type": "string",
20+
"description": "The name of the application. Corresponds to the Maven 'artifactId'.",
21+
"examples": [
22+
"some-application-system"
23+
]
24+
},
25+
"version": {
26+
"type": "string",
27+
"description": "The version of the deployed application.",
28+
"examples": [
29+
"2019.8.1", "2020.1.2-SNAPSHOT"
30+
]
31+
},
32+
"stage": {
33+
"type": "string",
34+
"description": "The stage (environment) the application is currently running.",
35+
"enum": [
36+
"local",
37+
"deve",
38+
"apps",
39+
"ints",
40+
"prod",
41+
"trai",
42+
"pref",
43+
"phot"
44+
]
45+
}
46+
}
47+
}
48+
}
49+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#%RAML 1.0 Library
2+
usage: Shared DataType definitions for the **canda-mule4-example** API.
3+
4+
types:
5+
greeting: !include types/greeting-schema.json
6+
greetings: !include types/greetings-schema.json
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"id": "82157f46-887e-4907-b7c6-06278b3b9ea1",
3+
"message": "Welcome and thanks for your request, mike."
4+
}

0 commit comments

Comments
 (0)