8000 Fix OpenAPI spec key reordering on incremental builds by Pepo48 · Pull Request #48371 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion js/libs/keycloak-admin-client/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ components:
uniqueItems: true
items:
type: string
pattern: \S
description: URIs that the browser can redirect to after login
roles:
type: array
uniqueItems: true
items:
type: string
pattern: \S
description: Roles associated with this client
protocol:
type: string
Expand Down Expand Up @@ -91,12 +93,14 @@ components:
uniqueItems: true
items:
type: string
pattern: \S
description: Web origins that are allowed to make requests to this client
serviceAccountRoles:
type: array
uniqueItems: true
items:
type: string
pattern: \S
description: Roles assigned to the service account
protocol:
type: string
Expand Down Expand Up @@ -157,7 +161,6 @@ components:
description: Bearer token authentication using a Keycloak access token
tags:
- name: Clients (v2)
x-smallrye-profile-admin: ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pepo48 does this mean we need to update our usage of these annotations @Extension(name = KeycloakOpenAPI.Profiles.ADMIN, value = "") - for whatever reason the value is null in all of them, and it looks now that will simply get omitted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shawkins tl;dr I don't think that annotations need any updating at this point.

My understanding of the change in smallrye-open-api/pull/2490 is prior to the PR, the tag copy leaked into the output as (most likely harmless) x-smallrye-profile-admin: "" and in 4.3.1 the new ExtensionRemovalFilter strips it.

The question rather is, do we even need these annotations? For v2 we have no scanProfiles, so they never had any effect, right? I already tried earlier today to just remove @Extension(name = KeycloakOpenAPI.Profiles.ADMIN, value = "") from ClientsApi.java and nothing happened after the rebuild, the spec was identical. But I didn't want to touch this part unnecessarily as I am not that familiar in this area, so I may be missing something that is evident (my only goal was to get rid of the annoying spec drifts 😊).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question rather is, do we even need these annotations? For v2 we have no scanProfiles, so they never had any effect, right?

My answer to both is I don't know, so I wanted to check before something was removed.

With #25259 it seems like they were used to just trigger the openapi inclusion, not that anyone was looking for the custom value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep as is. We can discuss and eventually remove the annotation as a follow-up.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent is that x-smallrye-profile-* extensions generally shouldn't be in the output so it's a little surprising they were there previously. Are you only generating this file using the OpenAPI Maven plugin?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MikeEdgar yes, it's fully generated from annotations (without manual edits) via SmallRye OpenAPI plugin.

paths:
/admin/api/{realmName}/clients/{version}:
get:
Expand Down
3 changes: 2 additions & 1 deletion rest/admin-v2/services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Use OpenAPI 4.x compatible plugin version -->
<smallrye.openapi.generator.plugin.version>4.2.4</smallrye.openapi.generator.plugin.version>
<smallrye.openapi.generator.plugin.version>4.3.1</smallrye.openapi.generator.plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -85,6 +85,7 @@
<groupId>io.smallrye</groupId>
<artifactId>smallrye-open-api-maven-plugin</artifactId>
<configuration>
<enableStandardStaticFiles>false</enableStandardStaticFiles>
<scanPackages>org.keycloak.representations.admin.v2,org.keycloak.admin.api</scanPackages>
<filter>org.keycloak.admin.internal.openapi.OASModelFilter</filter>
<outputDirectory>${project.build.directory}</outputDirectory>
Expand Down
Loading
0