Skip to content

Commit 075a323

Browse files
authored
Merge degroff/ENG-1/issue1 (#165)
1 parent b79b8fb commit 075a323

87 files changed

Lines changed: 1305 additions & 152 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bin/build-openapi-yaml.rb

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,9 @@ def addListValue(hash, key, listElementType, identity_providers, rootkey = nil,
277277
end
278278
end
279279

280-
def param_optional(comments_arr)
281-
if comments_arr && comments_arr[0].include?("(Optional)")
282-
return true
283-
end
284-
return false
280+
# Returns true if the 1st comment includes (Optional)
281+
def param_optional(param)
282+
param['comments']&.[](0)&.include?("(Optional)")
285283
end
286284

287285
def process_rawpaths(rawpaths, options)
@@ -347,7 +345,7 @@ def process_api_file(fn, paths, options, deferred)
347345
next
348346
end
349347

350-
if param_optional(p["comments"])
348+
if param_optional(p)
351349
uri = uri + "/{" + p["name"] + "}"
352350
else
353351
uri = uri + "/{" + p["name"] + "}"
@@ -508,7 +506,7 @@ def build_path(uri, json, paths, include_optional_segment_param, options)
508506
next
509507
end
510508

511-
if param_optional(p["comments"])
509+
if param_optional(p)
512510
if include_optional_segment_param
513511
# we have an optional param but it is in the URI, so we want to add it to the parameters
514512
params << build_openapi_paramobj(p, "path")
@@ -576,12 +574,24 @@ def build_openapi_paramobj(jsonparamobj, paramtype)
576574
paramobj = {}
577575
paramobj["name"] = jsonparamobj["name"]
578576
paramobj["in"] = paramtype
579-
paramobj["schema"] = {}
580-
paramobj["schema"]["type"] = "string"
577+
# Cover Java generics here
578+
paramobj["schema"] = if %w[Collection<String> List<String> Set<String>].include? jsonparamobj['javaType']
579+
{
580+
'type' => 'array',
581+
'items' => {
582+
'type' => 'string'
583+
}
584+
}
585+
else
586+
{ 'type' => 'string' }
587+
end
581588

582589
if paramtype == "path"
583590
paramobj["required"] = true
584591
end
592+
if jsonparamobj['optional']
593+
paramobj['required'] = false
594+
end
585595
if jsonparamobj["comments"] && jsonparamobj["comments"][0]
586596
paramobj["description"] = jsonparamobj["comments"].join(" ").gsub('(Optional)', '').gsub("\n", '').delete("\n").strip
587597
end

build.savant

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2024, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2019-2025, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -93,6 +93,7 @@ target(name: "generateDomain", description: "Generates all of the json files for
9393
"io.fusionauth.api.domain.json.annotation.MaskMapValue.json",
9494
"io.fusionauth.domain.Buildable.json",
9595
"io.fusionauth.domain.Integration.json",
96+
"io.fusionauth.domain.RateLimitedRequestType.json",
9697
"io.fusionauth.domain.util.DefaultTools.json",
9798
"io.fusionauth.domain.util.Normalizer.json",
9899
"io.fusionauth.domain.util.SQLTools.json",
@@ -170,6 +171,9 @@ target(name: "build-java", description: "Build the Java Client Library") {
170171
filter(token: ".*@MaskMapValue\\(.*\n", value: "")
171172
filter(token: ".*@MaskString.*\n", value: "")
172173
filter(token: ".*@InternalUse.*\n ", value: "")
174+
// don't want internal tickets and such in here
175+
filter(token: "// TODO : ENG.*", value: "")
176+
filter(token: "// INTERNAL.*", value: "")
173177
}
174178
file.prune(dir: "../fusionauth-java-client/src/main/java/io/fusionauth/client")
175179
file.copy(to: "../fusionauth-java-client/src/main/java/io/fusionauth/client") {
@@ -200,6 +204,10 @@ target(name: "build-netcore", description: "Build the C# .netCore Client Library
200204
clientLibrary.buildDomain(template: "src/main/client/netcore.domain.ftl",
201205
outputDir: "../fusionauth-netcore-client/fusionauth-netcore-client/domain",
202206
extension: "cs")
207+
file.delete {
208+
// exclude IdentityType.cs
209+
fileSet(dir: "../fusionauth-netcore-client/fusionauth-netcore-client/domain/", includePatterns: [~/\/IdentityType.cs/])
210+
}
203211
}
204212

205213
target(name: "build-typescript", description: "Build the Typescript Client Library") {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"uri": "/api/identity/verify/complete",
3+
"comments": [
4+
"Completes verification of an identity using verification codes from the Verify Start API."
5+
],
6+
"method": "post",
7+
"methodName": "completeVerifyIdentity",
8+
"successResponse": "VerifyCompleteResponse",
9+
"errorResponse": "Errors",
10+
"params": [
11+
{
12+
"name": "request",
13+
"comments": [
14+
"The identity verify complete request that contains all the information used to verify the identity."
15+
],
16+
"type": "body",
17+
"javaType": "VerifyCompleteRequest"
18+
}
19+
]
20+
}

src/main/api/retrieveUserByLoginId.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"javaType": "String"
1919
}
2020
]
21-
}
21+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"uri": "/api/user",
3+
"comments": [
4+
"Retrieves the user for the loginId, using specific loginIdTypes."
5+
],
6+
"method": "get",
7+
"methodName": "retrieveUserByLoginIdWithLoginIdTypes",
8+
"successResponse": "UserResponse",
9+
"errorResponse": "Errors",
10+
"params": [
11+
{
12+
"name": "loginId",
13+
"comments": [
14+
"The email or username of the user."
15+
],
16+
"type": "urlParameter",
17+
"parameterName": "loginId",
18+
"javaType": "String"
19+
},
20+
{
21+
"name": "loginIdTypes",
22+
"comments": [
23+
"the identity types that FusionAuth will compare the loginId to."
24+
],
25+
"type": "urlParameter",
26+
"parameterName": "loginIdTypes",
27+
"javaType": "List<String>"
28+
}
29+
]
30+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"uri": "/api/report/login",
3+
"comments": [
4+
"Retrieves the login report between the two instants for a particular user by login Id, using specific loginIdTypes. If you specify an application id, it will only return the",
5+
"login counts for that application."
6+
],
7+
"method": "get",
8+
"methodName": "retrieveUserLoginReportByLoginIdAndLoginIdTypes",
9+
"successResponse": "LoginReportResponse",
10+
"errorResponse": "Errors",
11+
"params": [
12+
{
13+
"name": "applicationId",
14+
"comments": [
15+
"(Optional) The application id."
16+
],
17+
"type": "urlParameter",
18+
"parameterName": "applicationId",
19+
"javaType": "UUID"
20+
},
21+
{
22+
"name": "loginId",
23+
"comments": [
24+
"The userId id."
25+
],
26+
"type": "urlParameter",
27+
"parameterName": "loginId",
28+
"javaType": "String"
29+
},
30+
{
31+
"name": "start",
32+
"comments": [
33+
"The start instant as UTC milliseconds since Epoch."
34+
],
35+
"type": "urlParameter",
36+
"parameterName": "start",
37+
"javaType": "long"
38+
},
39+
{
40+
"name": "end",
41+
"comments": [
42+
"The end instant as UTC milliseconds since Epoch."
43+
],
44+
"type": "urlParameter",
45+
"parameterName": "end",
46+
"javaType": "long"
47+
},
48+
{
49+
"name": "loginIdTypes",
50+
"comments": [
51+
"the identity types that FusionAuth will compare the loginId to."
52+
],
53+
"type": "urlParameter",
54+
"parameterName": "loginIdTypes",
55+
"javaType": "List<String>"
56+
}
57+
]
58+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"uri": "/api/identity/verify/send",
3+
"comments": [
4+
"Send a verification code using the appropriate transport for the identity type being verified."
5+
],
6+
"method": "post",
7+
"methodName": "sendVerifyIdentity",
8+
"successResponse": "Void",
9+
"errorResponse": "Errors",
10+
"params": [
11+
{
12+
"name": "request",
13+
"comments": [
14+
"The identity verify send request that contains all the information used send the code."
15+
],
16+
"type": "body",
17+
"javaType": "VerifySendRequest"
18+
}
19+
]
20+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"uri": "/api/identity/verify/start",
3+
"comments": [
4+
"Start a verification of an identity by generating a code. This code can be sent to the User using the Verify Send API",
5+
"Verification Code API or using a mechanism outside of FusionAuth. The verification is completed by using the Verify Complete API with this code."
6+
],
7+
"method": "post",
8+
"methodName": "startVerifyIdentity",
9+
"successResponse": "VerifyStartResponse",
10+
"errorResponse": "Errors",
11+
"params": [
12+
{
13+
"name": "request",
14+
"comments": [
15+
"The identity verify start request that contains all the information used to begin the request."
16+
],
17+
"type": "body",
18+
"javaType": "VerifyStartRequest"
19+
}
20+
]
21+
}

src/main/api/verifyIdentity.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"uri": "/api/identity/verify",
3+
"comments": [
4+
"Administratively verify a user identity."
5+
],
6+
"method": "post",
7+
"methodName": "verifyIdentity",
8+
"successResponse": "Void",
9+
"errorResponse": "Errors",
10+
"params": [
11+
{
12+
"name": "request",
13+
"comments": [
14+
"The identity verify request that contains information to verify the identity."
15+
],
16+
"type": "body",
17+
"javaType": "VerifyRequest"
18+
}
19+
]
20+
}

src/main/client/_macros.ftl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
[#case "long"]
1515
[#case "Long"][#return "long?"]
1616
[#case "Void"][#return "RESTVoid"]
17+
[#case "IdentityType"]
1718
[#case "LocalDate"]
1819
[#case "Locale"]
1920
[#case "URI"]
@@ -32,8 +33,8 @@
3233
[#case "KeyType"][#return "KeyType?"/]
3334
[#case "KeyAlgorithm"][#return "KeyAlgorithm?"/]
3435
[#default]
35-
[#if type?starts_with("Collection")]
36-
[#return type?replace("Collection", "List")?replace("UUID", "string")/]
36+
[#if type?starts_with("Collection") || type?starts_with("List")]
37+
[#return type?replace("Collection", "List")?replace("UUID", "string")?replace("String", "string")/]
3738
[#else]
3839
[#return type/]
3940
[/#if]
@@ -51,9 +52,9 @@
5152
[#return "int64"/]
5253
[#elseif type == "Void"]
5354
[#return "nil"/]
54-
[#elseif type?starts_with("Collection")]
55-
[#return type?replace("Collection", "[]")?replace("UUID", "string")?replace("<", "")?replace(">", "")/]
56-
[#elseif type == "String" || type = "UUID" || type == "ZoneId" || type == "URI" || type == "Locale" || type == "LocalDate" || type == "char" ]
55+
[#elseif type?starts_with("Collection<") || type?starts_with("List<")]
56+
[#return type?replace("Collection", "[]")?replace("List", "[]")?replace("UUID", "string")?replace("<", "")?replace(">", "")?replace("String", "string")/]
57+
[#elseif type == "String" || type = "UUID" || type == "ZoneId" || type == "URI" || type == "Locale" || type == "LocalDate" || type == "char" || type == "IdentityType" ]
5758
[#return "string"/]
5859
[#elseif type == "Object" || type == "D" || type == "T"]
5960
[#return "interface{}"/]
@@ -96,7 +97,7 @@
9697
[#case "JWT"][#return "JWT | object"/]
9798
[#case "Void"][#return "void"/]
9899
[#default]
99-
[#if type?starts_with("Collection")]
100+
[#if type?starts_with("Collection<") || type?starts_with("List<")]
100101
[#return type?replace("Collection", "Array")?replace("UUID", "string")/]
101102
[#else]
102103
[#return type/]
@@ -131,8 +132,8 @@
131132
[#case "Object"][#return "any"/]
132133
[#case "Void"][#return "void"/]
133134
[#default]
134-
[#if type?starts_with("Collection")]
135-
[#return type?replace("Collection", "Array")?replace("UUID", "string")/]
135+
[#if type?starts_with("Collection<") || type?starts_with("List<")]
136+
[#return type?replace("Collection", "Array")?replace("List", "Array")?replace("UUID", "string")/]
136137
[#else]
137138
[#return type/]
138139
[/#if]
@@ -154,7 +155,7 @@
154155
[#elseif language == "ruby"]
155156
[#if type == "UUID" || type == "String" || type == "IdentityProviderType" || type == "LambdaType"]
156157
[#return "string"/]
157-
[#elseif type?starts_with("Collection")]
158+
[#elseif type?starts_with("Collection<") || type?starts_with("List<")]
158159
[#return "Array"/]
159160
[#elseif type == "boolean" || type == "Boolean"]
160161
[#return "Boolean"/]

0 commit comments

Comments
 (0)