Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] [doc] fix multiple apis in the automatically generated documentation use the same anchor point #19193

Merged
Merged
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
16 changes: 15 additions & 1 deletion pulsar-broker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -697,11 +697,13 @@
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.7</version>
<version>3.1.8</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>false</springmvc>
<operationIdFormat>{{className}}_{{methodName}}</operationIdFormat>
Copy link
Contributor

@heesung-sn heesung-sn Mar 8, 2023

Choose a reason for hiding this comment

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

nit: I think {className}_{methodName} is reasonable as the unique operationIdFormat.

LGTM if we don't have duplicated apiSources from the same class and methodName.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After keeping only the latest version of admin API(such as v2, v3), {className}_{methodName} will not conflict. If we open multiple versions of API in the future, we need to change the rule to {package_name}_{className}_{methodName}

<outputFormats>json</outputFormats>
Copy link
Contributor

@heesung-sn heesung-sn Mar 8, 2023

Choose a reason for hiding this comment

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

nit: Is this json outputFormats necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: Is this json outputFormats necessary?

It should be optional, but maven or swagger had issues, and I had null Pointers when testing locally. I tried troubleshooting the issue yesterday but couldn't get the root cause quickly, so I thought adding this configuration would avoid unnecessary trouble.

<locations>
<location>org.apache.pulsar.broker.admin.v2.Bookies</location>
<location>org.apache.pulsar.broker.admin.v2.BrokerStats</location>
Expand Down Expand Up @@ -737,6 +739,8 @@
</apiSource>
<apiSource>
<springmvc>false</springmvc>
<operationIdFormat>{{className}}_{{methodName}}</operationIdFormat>
<outputFormats>json</outputFormats>
<locations>org.apache.pulsar.broker.lookup.v2</locations>
<schemes>http,https</schemes>
<basePath>/lookup</basePath>
Expand All @@ -754,6 +758,8 @@
</apiSource>
<apiSource>
<springmvc>false</springmvc>
<operationIdFormat>{{className}}_{{methodName}}</operationIdFormat>
<outputFormats>json</outputFormats>
<locations>org.apache.pulsar.broker.admin.v3.Functions</locations>
<schemes>http,https</schemes>
<basePath>/admin/v3</basePath>
Expand All @@ -771,6 +777,8 @@
</apiSource>
<apiSource>
<springmvc>false</springmvc>
<operationIdFormat>{{className}}_{{methodName}}</operationIdFormat>
<outputFormats>json</outputFormats>
<locations>org.apache.pulsar.broker.admin.v3.Transactions</locations>
<schemes>http,https</schemes>
<basePath>/admin/v3</basePath>
Expand All @@ -788,6 +796,8 @@
</apiSource>
<apiSource>
<springmvc>false</springmvc>
<operationIdFormat>{{className}}_{{methodName}}</operationIdFormat>
<outputFormats>json</outputFormats>
<locations>org.apache.pulsar.broker.admin.v3.Sources</locations>
<schemes>http,https</schemes>
<basePath>/admin/v3</basePath>
Expand All @@ -805,6 +815,8 @@
</apiSource>
<apiSource>
<springmvc>false</springmvc>
<operationIdFormat>{{className}}_{{methodName}}</operationIdFormat>
<outputFormats>json</outputFormats>
<locations>org.apache.pulsar.broker.admin.v3.Sinks</locations>
<schemes>http,https</schemes>
<basePath>/admin/v3</basePath>
Expand All @@ -822,6 +834,8 @@
</apiSource>
<apiSource>
<springmvc>false</springmvc>
<operationIdFormat>{{className}}_{{methodName}}</operationIdFormat>
<outputFormats>json</outputFormats>
<locations>org.apache.pulsar.broker.admin.v3.Packages</locations>
<schemes>http,https</schemes>
<basePath>/admin/v3</basePath>
Expand Down