Skip to content

Commit

Permalink
fix: fix typos and other issues in jans-config-api swagger specs #1665 (
Browse files Browse the repository at this point in the history
  • Loading branch information
duttarnab authored Jul 4, 2022
1 parent 942b9a8 commit 3c3a0f4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class AttributeNames {
public static final String SCOPES = "scopes";
public static final String GRANT_TYPES = "grant types";
public static final String DATA_TYPE = "dataType";
public static final String REDIRECT_URIS = "redirectUris";

private AttributeNames() {
}
Expand Down
13 changes: 7 additions & 6 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1892,8 +1892,8 @@ paths:
post:
tags:
- OAuth - OpenID Connect - Clients
summary: Create new OpenId connect client
description: Create new OpenId connect client
summary: Create new OpenId Connect client
description: Create new OpenId Connect client
operationId: post-oauth-openid-clients
requestBody:
content:
Expand Down Expand Up @@ -5048,10 +5048,7 @@ components:
description: Client.
type: object
required:
- applicationType
- logout
- includeClaimsInIdToken
- displayName
- redirectUris
properties:
dn:
type: string
Expand Down Expand Up @@ -6061,6 +6058,10 @@ components:
properties:
month:
type: integer
start_month:
type: integer
end_month:
type: integer
monthly_active_users:
type: integer
format: int64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public Response createOpenIdConnect(@Valid Client client) throws EncryptionExcep
inum = inumService.generateClientInum();
client.setClientId(inum);
}
checkNotNull(client.getDisplayName(), AttributeNames.DISPLAY_NAME);
checkNotNull(client.getRedirectUris(), AttributeNames.REDIRECT_URIS);

//scope validation
checkScopeFormat(client);
Expand Down Expand Up @@ -148,7 +148,7 @@ public Response updateClient(@Valid Client client) throws EncryptionException {
}
String inum = client.getClientId();
checkNotNull(inum, AttributeNames.INUM);
checkNotNull(client.getDisplayName(), AttributeNames.DISPLAY_NAME);
checkNotNull(client.getRedirectUris(), AttributeNames.REDIRECT_URIS);
Client existingClient = clientService.getClientByInum(inum);
checkResourceNotNull(existingClient, OPENID_CONNECT_CLIENT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class StatResource extends ConfigBaseResource {
@Produces(MediaType.APPLICATION_JSON)
public Response getStatistics(@HeaderParam("Authorization") String authorization,
@QueryParam(value = "month") String month,
@QueryParam(value = "start-month") String startMonth,
@QueryParam(value = "end-month") String endMonth,
@QueryParam(value = "start_month") String startMonth,
@QueryParam(value = "end_month") String endMonth,
@QueryParam(value = "format") String format) {
if (StringUtils.isBlank(format)) {
format = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public static void checkNotNull(String attribute, String attributeName) {
}
}

public static void checkNotNull(String[] attributes, String attributeName) {
if (attributes == null || attributes.length <= 0) {
throw new BadRequestException(getMissingAttributeError(attributeName));
}
}

public static void throwMissingAttributeError(String attributeName) {
if (StringUtils.isNotEmpty(attributeName)) {
throw new BadRequestException(getMissingAttributeError(attributeName));
Expand Down

0 comments on commit 3c3a0f4

Please sign in to comment.