@ahmttyydn/java-integration 1.0.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.
- package/CHANGELOG.md +762 -0
- package/README.md +37 -0
- package/package.json +46 -0
- package/pom.xml +242 -0
- package/scalar-core/pom.xml +92 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/ScalarConstants.java +26 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/ScalarHtmlRenderer.java +135 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/ScalarProperties.java +596 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/ScalarAuthenticationOptions.java +235 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/AuthorizationCodeFlow.java +160 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ClientCredentialsFlow.java +88 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ImplicitFlow.java +64 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/OAuthFlow.java +185 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/PasswordFlow.java +134 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ScalarFlows.java +113 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarApiKeySecurityScheme.java +77 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarHttpSecurityScheme.java +115 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarOAuth2SecurityScheme.java +75 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarSecurityScheme.java +45 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/config/DefaultHttpClient.java +77 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarAgentOptions.java +68 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarServer.java +197 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarSource.java +151 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/CredentialsLocation.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/DeveloperToolsVisibility.java +58 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/DocumentDownloadType.java +67 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/OperationSorter.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/OperationTitleSource.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/Pkce.java +57 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/PropertyOrder.java +53 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarClient.java +208 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarLayout.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarTarget.java +158 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarTheme.java +102 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/TagSorter.java +47 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ThemeMode.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/internal/ScalarConfiguration.java +425 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/internal/ScalarConfigurationMapper.java +69 -0
- package/scalar-core/src/main/resources/META-INF/resources/webjars/scalar/index.html +22 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/ScalarConfigurationTest.java +144 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/ScalarHtmlRendererTest.java +104 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/ScalarPropertiesTest.java +525 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/config/DefaultHttpClientTest.java +61 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarAgentOptionsTest.java +80 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarServerTest.java +118 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarSourceTest.java +105 -0
- package/scalar-playground-webflux/pom.xml +52 -0
- package/scalar-playground-webflux/src/main/java/com/scalar/maven/playground/CustomScalarWebFluxController.java +34 -0
- package/scalar-playground-webflux/src/main/java/com/scalar/maven/playground/PlaygroundApplication.java +27 -0
- package/scalar-playground-webflux/src/main/resources/application.properties +7 -0
- package/scalar-playground-webmvc/pom.xml +52 -0
- package/scalar-playground-webmvc/src/main/java/com/scalar/maven/playground/CustomScalarWebMvcController.java +34 -0
- package/scalar-playground-webmvc/src/main/java/com/scalar/maven/playground/PlaygroundApplication.java +27 -0
- package/scalar-playground-webmvc/src/main/resources/application.properties +7 -0
- package/scalar-webflux/pom.xml +110 -0
- package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxActuatorEndpoint.java +103 -0
- package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxAutoConfiguration.java +63 -0
- package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxController.java +109 -0
- package/scalar-webflux/src/main/java/com/scalar/maven/webflux/SpringBootScalarProperties.java +43 -0
- package/scalar-webflux/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +2 -0
- package/scalar-webflux/src/test/java/com/scalar/maven/webflux/ScalarWebFluxActuatorEndpointTest.java +136 -0
- package/scalar-webflux/src/test/java/com/scalar/maven/webflux/ScalarWebFluxControllerTest.java +162 -0
- package/scalar-webmvc/pom.xml +103 -0
- package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcActuatorEndpoint.java +97 -0
- package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcAutoConfiguration.java +63 -0
- package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcController.java +103 -0
- package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/SpringBootScalarProperties.java +43 -0
- package/scalar-webmvc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +2 -0
- package/scalar-webmvc/src/test/java/com/scalar/maven/webmvc/ScalarWebMvcActuatorEndpointTest.java +128 -0
- package/scalar-webmvc/src/test/java/com/scalar/maven/webmvc/ScalarWebMvcControllerTest.java +154 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
package com.scalar.maven.core.authentication.schemes;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
|
4
|
+
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the base class for security schemes in Scalar.
|
|
8
|
+
*/
|
|
9
|
+
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
|
10
|
+
@JsonSubTypes({
|
|
11
|
+
@JsonSubTypes.Type(value = ScalarHttpSecurityScheme.class),
|
|
12
|
+
@JsonSubTypes.Type(value = ScalarApiKeySecurityScheme.class),
|
|
13
|
+
@JsonSubTypes.Type(value = ScalarOAuth2SecurityScheme.class)
|
|
14
|
+
})
|
|
15
|
+
public abstract class ScalarSecurityScheme {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Gets or sets the description of this security scheme.
|
|
19
|
+
*/
|
|
20
|
+
private String description;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new ScalarSecurityScheme.
|
|
24
|
+
*/
|
|
25
|
+
protected ScalarSecurityScheme() {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Gets the description of this security scheme.
|
|
30
|
+
*
|
|
31
|
+
* @return the description
|
|
32
|
+
*/
|
|
33
|
+
public String getDescription() {
|
|
34
|
+
return description;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Sets the description of this security scheme.
|
|
39
|
+
*
|
|
40
|
+
* @param description the description
|
|
41
|
+
*/
|
|
42
|
+
public void setDescription(String description) {
|
|
43
|
+
this.description = description;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
package com.scalar.maven.core.config;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
4
|
+
import com.scalar.maven.core.enums.ScalarClient;
|
|
5
|
+
import com.scalar.maven.core.enums.ScalarTarget;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents the default HTTP client configuration for the Scalar API
|
|
9
|
+
* reference.
|
|
10
|
+
*/
|
|
11
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
12
|
+
public class DefaultHttpClient {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets or sets the target key for the HTTP client.
|
|
16
|
+
*/
|
|
17
|
+
private ScalarTarget targetKey;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Gets or sets the client key for the HTTP client.
|
|
21
|
+
*/
|
|
22
|
+
private ScalarClient clientKey;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new DefaultHttpClient with the default target and client keys.
|
|
27
|
+
*/
|
|
28
|
+
public DefaultHttpClient() {
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new DefaultHttpClient with the specified target and client keys.
|
|
33
|
+
*
|
|
34
|
+
* @param targetKey the target key
|
|
35
|
+
* @param clientKey the client key
|
|
36
|
+
*/
|
|
37
|
+
public DefaultHttpClient(ScalarTarget targetKey, ScalarClient clientKey) {
|
|
38
|
+
this.targetKey = targetKey;
|
|
39
|
+
this.clientKey = clientKey;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Gets the target key.
|
|
44
|
+
*
|
|
45
|
+
* @return the target key
|
|
46
|
+
*/
|
|
47
|
+
public ScalarTarget getTargetKey() {
|
|
48
|
+
return targetKey;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Sets the target key.
|
|
53
|
+
*
|
|
54
|
+
* @param targetKey the target key
|
|
55
|
+
*/
|
|
56
|
+
public void setTargetKey(ScalarTarget targetKey) {
|
|
57
|
+
this.targetKey = targetKey;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Gets the client key.
|
|
62
|
+
*
|
|
63
|
+
* @return the client key
|
|
64
|
+
*/
|
|
65
|
+
public ScalarClient getClientKey() {
|
|
66
|
+
return clientKey;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Sets the client key.
|
|
71
|
+
*
|
|
72
|
+
* @param clientKey the client key
|
|
73
|
+
*/
|
|
74
|
+
public void setClientKey(ScalarClient clientKey) {
|
|
75
|
+
this.clientKey = clientKey;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package com.scalar.maven.core.config;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Agent Scalar configuration options.
|
|
7
|
+
* Enables the AI chat interface in the API Reference or disables it entirely.
|
|
8
|
+
*
|
|
9
|
+
* @see <a href="https://github.com/scalar/scalar/blob/main/documentation/configuration.md">Configuration</a>
|
|
10
|
+
*/
|
|
11
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
12
|
+
public class ScalarAgentOptions {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Agent Scalar key for production deployments. Required for Agent Scalar to
|
|
16
|
+
* appear in production; when omitted, the agent is enabled only on localhost
|
|
17
|
+
* with limited free messages.
|
|
18
|
+
*/
|
|
19
|
+
private String key;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* When true, disables the Agent Scalar chat interface for this source or
|
|
23
|
+
* for the entire reference (when set at top level).
|
|
24
|
+
*/
|
|
25
|
+
private Boolean disabled;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates agent options with no key and not disabled.
|
|
29
|
+
*/
|
|
30
|
+
public ScalarAgentOptions() {
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Gets the Agent Scalar key.
|
|
35
|
+
*
|
|
36
|
+
* @return the key or null
|
|
37
|
+
*/
|
|
38
|
+
public String getKey() {
|
|
39
|
+
return key;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Sets the Agent Scalar key.
|
|
44
|
+
*
|
|
45
|
+
* @param key the key
|
|
46
|
+
*/
|
|
47
|
+
public void setKey(String key) {
|
|
48
|
+
this.key = key;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Gets whether the agent is disabled.
|
|
53
|
+
*
|
|
54
|
+
* @return true if disabled, false if enabled, null if not set
|
|
55
|
+
*/
|
|
56
|
+
public Boolean getDisabled() {
|
|
57
|
+
return disabled;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Sets whether the agent is disabled.
|
|
62
|
+
*
|
|
63
|
+
* @param disabled true to disable, false or null to use default behavior
|
|
64
|
+
*/
|
|
65
|
+
public void setDisabled(Boolean disabled) {
|
|
66
|
+
this.disabled = disabled;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
package com.scalar.maven.core.config;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
4
|
+
|
|
5
|
+
import java.util.Map;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents a server configuration for the Scalar API Reference.
|
|
9
|
+
*/
|
|
10
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
11
|
+
public class ScalarServer {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The URL of the server.
|
|
15
|
+
*/
|
|
16
|
+
private String url;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A description of the server.
|
|
20
|
+
*/
|
|
21
|
+
private String description;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A map of server variables.
|
|
25
|
+
*/
|
|
26
|
+
private Map<String, ServerVariable> variables;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new ScalarServer.
|
|
30
|
+
*/
|
|
31
|
+
public ScalarServer() {
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new ScalarServer with the specified URL.
|
|
36
|
+
*
|
|
37
|
+
* @param url the server URL
|
|
38
|
+
*/
|
|
39
|
+
public ScalarServer(String url) {
|
|
40
|
+
this.url = url;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new ScalarServer with the specified URL and description.
|
|
45
|
+
*
|
|
46
|
+
* @param url the server URL
|
|
47
|
+
* @param description the server description
|
|
48
|
+
*/
|
|
49
|
+
public ScalarServer(String url, String description) {
|
|
50
|
+
this.url = url;
|
|
51
|
+
this.description = description;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Gets the server URL.
|
|
56
|
+
*
|
|
57
|
+
* @return the server URL
|
|
58
|
+
*/
|
|
59
|
+
public String getUrl() {
|
|
60
|
+
return url;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Sets the server URL.
|
|
65
|
+
*
|
|
66
|
+
* @param url the server URL
|
|
67
|
+
*/
|
|
68
|
+
public void setUrl(String url) {
|
|
69
|
+
this.url = url;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gets the server description.
|
|
74
|
+
*
|
|
75
|
+
* @return the server description
|
|
76
|
+
*/
|
|
77
|
+
public String getDescription() {
|
|
78
|
+
return description;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Sets the server description.
|
|
83
|
+
*
|
|
84
|
+
* @param description the server description
|
|
85
|
+
*/
|
|
86
|
+
public void setDescription(String description) {
|
|
87
|
+
this.description = description;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Gets the server variables.
|
|
92
|
+
*
|
|
93
|
+
* @return the server variables
|
|
94
|
+
*/
|
|
95
|
+
public Map<String, ServerVariable> getVariables() {
|
|
96
|
+
return variables;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Sets the server variables.
|
|
101
|
+
*
|
|
102
|
+
* @param variables the server variables
|
|
103
|
+
*/
|
|
104
|
+
public void setVariables(Map<String, ServerVariable> variables) {
|
|
105
|
+
this.variables = variables;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Represents a server variable.
|
|
110
|
+
*/
|
|
111
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
112
|
+
public static class ServerVariable {
|
|
113
|
+
/**
|
|
114
|
+
* The default value for the variable.
|
|
115
|
+
*/
|
|
116
|
+
private String defaultValue;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A description of the variable.
|
|
120
|
+
*/
|
|
121
|
+
private String description;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* An array of possible values for the variable.
|
|
125
|
+
*/
|
|
126
|
+
private String[] enumValues;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Creates a new ServerVariable.
|
|
130
|
+
*/
|
|
131
|
+
public ServerVariable() {
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Creates a new ServerVariable with the specified default value.
|
|
136
|
+
*
|
|
137
|
+
* @param defaultValue the default value
|
|
138
|
+
*/
|
|
139
|
+
public ServerVariable(String defaultValue) {
|
|
140
|
+
this.defaultValue = defaultValue;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Gets the default value.
|
|
145
|
+
*
|
|
146
|
+
* @return the default value
|
|
147
|
+
*/
|
|
148
|
+
public String getDefaultValue() {
|
|
149
|
+
return defaultValue;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Sets the default value.
|
|
154
|
+
*
|
|
155
|
+
* @param defaultValue the default value
|
|
156
|
+
*/
|
|
157
|
+
public void setDefaultValue(String defaultValue) {
|
|
158
|
+
this.defaultValue = defaultValue;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Gets the description.
|
|
163
|
+
*
|
|
164
|
+
* @return the description
|
|
165
|
+
*/
|
|
166
|
+
public String getDescription() {
|
|
167
|
+
return description;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Sets the description.
|
|
172
|
+
*
|
|
173
|
+
* @param description the description
|
|
174
|
+
*/
|
|
175
|
+
public void setDescription(String description) {
|
|
176
|
+
this.description = description;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Gets the enum values.
|
|
181
|
+
*
|
|
182
|
+
* @return the enum values
|
|
183
|
+
*/
|
|
184
|
+
public String[] getEnumValues() {
|
|
185
|
+
return enumValues;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Sets the enum values.
|
|
190
|
+
*
|
|
191
|
+
* @param enumValues the enum values
|
|
192
|
+
*/
|
|
193
|
+
public void setEnumValues(String[] enumValues) {
|
|
194
|
+
this.enumValues = enumValues;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
package com.scalar.maven.core.config;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines an OpenAPI Reference source
|
|
7
|
+
*/
|
|
8
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
9
|
+
public class ScalarSource {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The URL of the OpenAPI specification to display in the API Reference.
|
|
13
|
+
*/
|
|
14
|
+
private String url;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The display title of the OpenAPI specification
|
|
18
|
+
* optional
|
|
19
|
+
*/
|
|
20
|
+
private String title;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The url slug of the OpenAPI specification
|
|
24
|
+
* optional, would be auto-generated from the title or the index
|
|
25
|
+
*/
|
|
26
|
+
private String slug;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Whether this is the default source
|
|
30
|
+
* optional
|
|
31
|
+
*/
|
|
32
|
+
private Boolean isDefault;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Agent Scalar options for this source (key for production, or disabled to
|
|
36
|
+
* turn off the agent for this document).
|
|
37
|
+
*/
|
|
38
|
+
private ScalarAgentOptions agent;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates an OpenAPI Reference source
|
|
42
|
+
* {@link #url} must be set
|
|
43
|
+
*/
|
|
44
|
+
public ScalarSource() {
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates an OpenAPI Reference source
|
|
49
|
+
*
|
|
50
|
+
* @param url the url of the OpenAPI specification
|
|
51
|
+
* @param title the display title of the OpenAPI specification
|
|
52
|
+
* @param slug the url slug of the OpenAPI specification
|
|
53
|
+
* @param isDefault whether this is the default source
|
|
54
|
+
*/
|
|
55
|
+
public ScalarSource(String url, String title, String slug, Boolean isDefault) {
|
|
56
|
+
this.url = url;
|
|
57
|
+
this.title = title;
|
|
58
|
+
this.slug = slug;
|
|
59
|
+
this.isDefault = isDefault;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Gets the URL of the OpenAPI specification
|
|
64
|
+
*
|
|
65
|
+
* @return the url
|
|
66
|
+
*/
|
|
67
|
+
public String getUrl() {
|
|
68
|
+
return url;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Sets the URL of the OpenAPI specification
|
|
73
|
+
*
|
|
74
|
+
* @param url the url
|
|
75
|
+
*/
|
|
76
|
+
public void setUrl(String url) {
|
|
77
|
+
this.url = url;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Gets the display title of the OpenAPI specification
|
|
82
|
+
*
|
|
83
|
+
* @return the display title or null
|
|
84
|
+
*/
|
|
85
|
+
public String getTitle() {
|
|
86
|
+
return title;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Sets the display title of the OpenAPI specification
|
|
91
|
+
*
|
|
92
|
+
* @param title the display title
|
|
93
|
+
*/
|
|
94
|
+
public void setTitle(String title) {
|
|
95
|
+
this.title = title;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Gets the url slug of the OpenAPI specification
|
|
100
|
+
*
|
|
101
|
+
* @return the url slug or null
|
|
102
|
+
*/
|
|
103
|
+
public String getSlug() {
|
|
104
|
+
return slug;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Sets the url slug of the OpenAPI specification
|
|
109
|
+
*
|
|
110
|
+
* @param slug the url slug
|
|
111
|
+
*/
|
|
112
|
+
public void setSlug(String slug) {
|
|
113
|
+
this.slug = slug;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Gets whether this is the default source
|
|
118
|
+
*
|
|
119
|
+
* @return whether this is the default source or null
|
|
120
|
+
*/
|
|
121
|
+
public Boolean isDefault() {
|
|
122
|
+
return isDefault;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Sets whether this is the default source
|
|
127
|
+
*
|
|
128
|
+
* @param isDefault whether this is the default source
|
|
129
|
+
*/
|
|
130
|
+
public void setDefault(Boolean isDefault) {
|
|
131
|
+
this.isDefault = isDefault;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Gets the Agent Scalar options for this source.
|
|
136
|
+
*
|
|
137
|
+
* @return the agent options or null
|
|
138
|
+
*/
|
|
139
|
+
public ScalarAgentOptions getAgent() {
|
|
140
|
+
return agent;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Sets the Agent Scalar options for this source.
|
|
145
|
+
*
|
|
146
|
+
* @param agent the agent options
|
|
147
|
+
*/
|
|
148
|
+
public void setAgent(ScalarAgentOptions agent) {
|
|
149
|
+
this.agent = agent;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
package com.scalar.maven.core.enums;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
4
|
+
import com.fasterxml.jackson.annotation.JsonValue;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents where OAuth2 credentials should be sent in HTTP requests.
|
|
8
|
+
*/
|
|
9
|
+
public enum CredentialsLocation {
|
|
10
|
+
/**
|
|
11
|
+
* Send credentials in the HTTP header.
|
|
12
|
+
*/
|
|
13
|
+
HEADER("header"),
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Send credentials in the HTTP body.
|
|
17
|
+
*/
|
|
18
|
+
BODY("body");
|
|
19
|
+
|
|
20
|
+
private final String value;
|
|
21
|
+
|
|
22
|
+
CredentialsLocation(String value) {
|
|
23
|
+
this.value = value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a CredentialsLocation from a string value.
|
|
28
|
+
*
|
|
29
|
+
* @param value the string value
|
|
30
|
+
* @return the corresponding CredentialsLocation
|
|
31
|
+
* @throws IllegalArgumentException if the value is not recognized
|
|
32
|
+
*/
|
|
33
|
+
@JsonCreator
|
|
34
|
+
public static CredentialsLocation fromValue(String value) {
|
|
35
|
+
for (CredentialsLocation location : values()) {
|
|
36
|
+
if (location.value.equals(value)) {
|
|
37
|
+
return location;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
throw new IllegalArgumentException("Unknown credentials location: " + value);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Gets the string value for JSON serialization.
|
|
45
|
+
*
|
|
46
|
+
* @return the string value
|
|
47
|
+
*/
|
|
48
|
+
@JsonValue
|
|
49
|
+
public String getValue() {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
package com.scalar.maven.core.enums;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
4
|
+
import com.fasterxml.jackson.annotation.JsonValue;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the visibility of the developer tools toolbar for the Scalar API Reference.
|
|
8
|
+
*/
|
|
9
|
+
public enum DeveloperToolsVisibility {
|
|
10
|
+
/**
|
|
11
|
+
* Always show the toolbar.
|
|
12
|
+
*/
|
|
13
|
+
ALWAYS("always"),
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Only show the toolbar on localhost or similar hosts.
|
|
17
|
+
*/
|
|
18
|
+
LOCALHOST("localhost"),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Never show the toolbar.
|
|
22
|
+
*/
|
|
23
|
+
NEVER("never");
|
|
24
|
+
|
|
25
|
+
private final String value;
|
|
26
|
+
|
|
27
|
+
DeveloperToolsVisibility(String value) {
|
|
28
|
+
this.value = value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates a DeveloperToolsVisibility from a string value.
|
|
33
|
+
*
|
|
34
|
+
* @param value the string value
|
|
35
|
+
* @return the corresponding DeveloperToolsVisibility
|
|
36
|
+
* @throws IllegalArgumentException if the value is not recognized
|
|
37
|
+
*/
|
|
38
|
+
@JsonCreator
|
|
39
|
+
public static DeveloperToolsVisibility fromValue(String value) {
|
|
40
|
+
for (DeveloperToolsVisibility visibility : values()) {
|
|
41
|
+
if (visibility.value.equals(value)) {
|
|
42
|
+
return visibility;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
throw new IllegalArgumentException("Unknown developer tools visibility: " + value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Gets the string value for JSON serialization.
|
|
50
|
+
*
|
|
51
|
+
* @return the string value
|
|
52
|
+
*/
|
|
53
|
+
@JsonValue
|
|
54
|
+
public String getValue() {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
package com.scalar.maven.core.enums;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
4
|
+
import com.fasterxml.jackson.annotation.JsonValue;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Specifies the available download formats for API documentation.
|
|
8
|
+
*/
|
|
9
|
+
public enum DocumentDownloadType {
|
|
10
|
+
/**
|
|
11
|
+
* Download documentation in JSON format.
|
|
12
|
+
*/
|
|
13
|
+
JSON("json"),
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Download documentation in YAML format.
|
|
17
|
+
*/
|
|
18
|
+
YAML("yaml"),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Download documentation in both JSON and YAML formats.
|
|
22
|
+
*/
|
|
23
|
+
BOTH("both"),
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Show the regular link to the OpenAPI document.
|
|
27
|
+
*/
|
|
28
|
+
DIRECT("direct"),
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Do not allow documentation downloads.
|
|
32
|
+
*/
|
|
33
|
+
NONE("none");
|
|
34
|
+
|
|
35
|
+
private final String value;
|
|
36
|
+
|
|
37
|
+
DocumentDownloadType(String value) {
|
|
38
|
+
this.value = value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates a DocumentDownloadType from a string value.
|
|
43
|
+
*
|
|
44
|
+
* @param value the string value
|
|
45
|
+
* @return the corresponding DocumentDownloadType
|
|
46
|
+
* @throws IllegalArgumentException if the value is not recognized
|
|
47
|
+
*/
|
|
48
|
+
@JsonCreator
|
|
49
|
+
public static DocumentDownloadType fromValue(String value) {
|
|
50
|
+
for (DocumentDownloadType type : values()) {
|
|
51
|
+
if (type.value.equals(value)) {
|
|
52
|
+
return type;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
throw new IllegalArgumentException("Unknown document download type: " + value);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Gets the string value for JSON serialization.
|
|
60
|
+
*
|
|
61
|
+
* @return the string value
|
|
62
|
+
*/
|
|
63
|
+
@JsonValue
|
|
64
|
+
public String getValue() {
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
}
|