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
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Restore `/openapi/v1/consumer-tokens/by-appId` to a token-specific response schema.
- Revert Portal Management consumer endpoint schemas to object-based Portal UI contracts.

### Added

- Add Consumer Token support notes to user management contracts, including `ManageUsers`-guarded user lookup and mutation operations.
- Add typed consumer management request, detail, and token schemas with `allowManageUsers` and `rateLimitEnabled` flags.

## [0.3.5] - 2026-05-31

Expand Down
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default.extend-identifiers]
ApiForhead = "ApiForhead"
127 changes: 5 additions & 122 deletions apollo-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ info:
<pre><code class="language-bash">curl -X GET "http://localhost:8070/openapi/v1/apps" \
-H "Authorization: your_token_here"</code></pre>

version: 0.3.7
version: 0.3.8
security:
- ApiKeyAuth: []
tags:
Expand Down Expand Up @@ -5348,15 +5348,15 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/OpenConsumerCreateRequestDTO'
type: object
required: true
responses:
'200':
description: 成功创建消费者
content:
application/json:
schema:
$ref: '#/components/schemas/OpenConsumerInfoDTO'
type: object
get:
summary: 查询开放平台消费者列表(new added)
operationId: getConsumerList
Expand Down Expand Up @@ -5385,7 +5385,7 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/OpenConsumerInfoDTO'
type: object
/openapi/v1/consumer-tokens/by-appId:
get:
summary: 按应用ID查询消费者Token(new added)
Expand All @@ -5406,7 +5406,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/OpenConsumerTokenDTO'
type: object
/openapi/v1/consumers/{token}/assign-role:
post:
summary: 给消费者授权(new added)
Expand Down Expand Up @@ -6830,123 +6830,6 @@ components:
hasPermission:
type: boolean
description: ''
OpenConsumerCreateRequestDTO:
type: object
required:
- appId
- name
- orgId
- ownerName
properties:
appId:
type: string
description: 第三方应用ID
allowCreateApplication:
type: boolean
description: 是否允许该Consumer Token创建应用
default: false
allowManageUsers:
type: boolean
description: 是否允许该Consumer Token管理用户
default: false
name:
type: string
description: 第三方应用名称
orgId:
type: string
description: 部门ID
orgName:
type: string
description: 部门名称
ownerName:
type: string
description: 负责人用户名
rateLimitEnabled:
type: boolean
description: 是否开启限流
default: false
rateLimit:
type: integer
description: 限流QPS,rateLimitEnabled 为 true 时必须大于 0;未开启限流时 0 表示不限流
minimum: 0
OpenConsumerInfoDTO:
type: object
properties:
appId:
type: string
description: 第三方应用ID
name:
type: string
description: 第三方应用名称
orgId:
type: string
description: 部门ID
orgName:
type: string
description: 部门名称
ownerName:
type: string
description: 负责人用户名
ownerEmail:
type: string
description: 负责人邮箱
consumerId:
type: integer
format: int64
description: Consumer ID
token:
type: string
description: Consumer Token,仅在创建或按应用查询详情时返回
allowCreateApplication:
type: boolean
description: 是否允许该Consumer Token创建应用
default: false
allowManageUsers:
type: boolean
description: 是否允许该Consumer Token管理用户
default: false
rateLimit:
type: integer
description: 限流QPS,0表示不限流
minimum: 0
default: 0
rateLimitEnabled:
type: boolean
description: 是否开启限流
default: false
OpenConsumerTokenDTO:
type: object
properties:
consumerId:
type: integer
format: int64
description: Consumer ID
token:
type: string
description: Consumer Token
rateLimit:
type: integer
description: 限流QPS,0表示不限流
minimum: 0
default: 0
expires:
type: string
format: date-time
description: 过期时间
dataChangeCreatedBy:
type: string
description: 创建人
dataChangeCreatedTime:
type: string
format: date-time
description: 创建时间
dataChangeLastModifiedBy:
type: string
description: 最后修改人
dataChangeLastModifiedTime:
type: string
format: date-time
description: 最后修改时间
OpenUserInfoDTO:
type: object
properties:
Expand Down
155 changes: 150 additions & 5 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,175 @@ echo "🚀 Generating Python SDK..."
-o "$PYTHON_DIR" \
-t "$PYTHON_TEMPLATE_DIR" \
--package-name apollo_openapi \
--additional-properties=projectName=apollo-openapi,packageVersion=0.3.7
--additional-properties=projectName=apollo-openapi,packageVersion=0.3.8

echo "🚀 Generating TypeScript SDK..."
"${OPENAPI_GENERATOR[@]}" generate \
-i "$SPEC_FILE" \
-g typescript-fetch \
-o "$TS_DIR" \
--additional-properties=npmName=apollo-openapi,npmVersion=0.3.7,typescriptThreePlus=true
--additional-properties=npmName=apollo-openapi,npmVersion=0.3.8,typescriptThreePlus=true

echo "🚀 Generating Java Client SDK..."
"${OPENAPI_GENERATOR[@]}" generate \
-i "$SPEC_FILE" \
-g java \
-o "$JAVA_CLIENT_DIR" \
--additional-properties hideGenerationTimestamp=true \
--additional-properties=groupId=com.apollo,artifactId=apollo-openapi-client,artifactVersion=0.3.7,packageName=com.apollo.openapi.client
--additional-properties=groupId=com.apollo,artifactId=apollo-openapi-client,artifactVersion=0.3.8,packageName=com.apollo.openapi.client

echo "🔧 Preserving Java client operator overloads..."
python3 - <<'PY'
from pathlib import Path

api_file = Path("java-client/src/main/java/org/openapitools/client/api/UserManagementApi.java")
content = api_file.read_text(encoding="utf-8")


def add_overload_before(marker, overload):
global content
if overload in content:
return
if marker not in content:
raise SystemExit(f"Could not find Java client overload marker:\n{marker}")
content = content.replace(marker, overload + marker, 1)


def add_overload_after(marker, overload):
global content
if overload in content:
return
if marker not in content:
raise SystemExit(f"Could not find Java client overload marker:\n{marker}")
content = content.replace(marker, marker + overload, 1)


add_overload_before(
""" @SuppressWarnings("rawtypes")
private okhttp3.Call changeUserEnabledValidateBeforeCall""",
""" /**
* Build call for changeUserEnabled.
* This overload preserves the Java client API for callers that do not need the optional operator query parameter.
*/
public okhttp3.Call changeUserEnabledCall(OpenUserDTO openUserDTO, final ApiCallback _callback) throws ApiException {
return changeUserEnabledCall(openUserDTO, null, _callback);
}

""",
)
add_overload_after(
""" public void changeUserEnabled(OpenUserDTO openUserDTO, String operator) throws ApiException {
changeUserEnabledWithHttpInfo(openUserDTO, operator);
}

""",
""" /**
* 修改用户启用状态(new added)
* This overload preserves the Java client API for callers that do not need the optional operator query parameter.
*/
public void changeUserEnabled(OpenUserDTO openUserDTO) throws ApiException {
changeUserEnabled(openUserDTO, null);
}

""",
)
add_overload_before(
""" /**
* 修改用户启用状态(new added) (asynchronously)
* PUT /openapi/v1/users/enabled""",
""" /**
* 修改用户启用状态(new added)
* This overload preserves the Java client API for callers that do not need the optional operator query parameter.
*/
public ApiResponse<Void> changeUserEnabledWithHttpInfo(OpenUserDTO openUserDTO) throws ApiException {
return changeUserEnabledWithHttpInfo(openUserDTO, null);
}

""",
)
add_overload_before(
""" /**
* Build call for createOrUpdateUser
* @param openUserDTO""",
"""
/**
* 修改用户启用状态(new added) (asynchronously)
* This overload preserves the Java client API for callers that do not need the optional operator query parameter.
*/
public okhttp3.Call changeUserEnabledAsync(OpenUserDTO openUserDTO, final ApiCallback<Void> _callback) throws ApiException {
return changeUserEnabledAsync(openUserDTO, null, _callback);
}

""",
)
add_overload_before(
""" @SuppressWarnings("rawtypes")
private okhttp3.Call createOrUpdateUserValidateBeforeCall""",
""" /**
* Build call for createOrUpdateUser.
* This overload preserves the Java client API for callers that do not need the optional operator query parameter.
*/
public okhttp3.Call createOrUpdateUserCall(OpenUserDTO openUserDTO, Boolean isCreate, final ApiCallback _callback) throws ApiException {
return createOrUpdateUserCall(openUserDTO, isCreate, null, _callback);
}

""",
)
add_overload_after(
""" public void createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate, String operator) throws ApiException {
createOrUpdateUserWithHttpInfo(openUserDTO, isCreate, operator);
}

""",
""" /**
* 创建或更新用户(new added)
* This overload preserves the Java client API for callers that do not need the optional operator query parameter.
*/
public void createOrUpdateUser(OpenUserDTO openUserDTO, Boolean isCreate) throws ApiException {
createOrUpdateUser(openUserDTO, isCreate, null);
}

""",
)
add_overload_before(
""" /**
* 创建或更新用户(new added) (asynchronously)
* POST /openapi/v1/users""",
""" /**
* 创建或更新用户(new added)
* This overload preserves the Java client API for callers that do not need the optional operator query parameter.
*/
public ApiResponse<Void> createOrUpdateUserWithHttpInfo(OpenUserDTO openUserDTO, Boolean isCreate) throws ApiException {
return createOrUpdateUserWithHttpInfo(openUserDTO, isCreate, null);
}

""",
)
add_overload_before(
""" /**
* Build call for getCurrentUser
* @param _callback""",
"""
/**
* 创建或更新用户(new added) (asynchronously)
* This overload preserves the Java client API for callers that do not need the optional operator query parameter.
*/
public okhttp3.Call createOrUpdateUserAsync(OpenUserDTO openUserDTO, Boolean isCreate, final ApiCallback<Void> _callback) throws ApiException {
return createOrUpdateUserAsync(openUserDTO, isCreate, null, _callback);
}
""",
)

api_file.write_text(content, encoding="utf-8")
PY

echo "🚀 Generating Spring Boot 2 Server..."
"${OPENAPI_GENERATOR[@]}" generate \
-i "$SPEC_FILE" \
-g spring \
-o "$SPRING_BOOT2_DIR" \
--additional-properties hideGenerationTimestamp=true \
--additional-properties=groupId=com.apollo,artifactId=apollo-openapi-server,artifactVersion=0.3.7,packageName=com.apollo.openapi.server,basePackage=com.apollo.openapi.server,configPackage=com.apollo.openapi.server.config,modelPackage=com.apollo.openapi.server.model,apiPackage=com.apollo.openapi.server.api,library=spring-boot,java8=true,interfaceOnly=false,delegatePattern=true,useTags=true
--additional-properties=groupId=com.apollo,artifactId=apollo-openapi-server,artifactVersion=0.3.8,packageName=com.apollo.openapi.server,basePackage=com.apollo.openapi.server,configPackage=com.apollo.openapi.server.config,modelPackage=com.apollo.openapi.server.model,apiPackage=com.apollo.openapi.server.api,library=spring-boot,java8=true,interfaceOnly=false,delegatePattern=true,useTags=true

echo "📦 Adding Maven Wrapper to Spring Boot 2 project..."
cd "$SPRING_BOOT2_DIR"
Expand All @@ -90,7 +235,7 @@ echo "🚀 Generating Rust SDK..."
-g rust \
-o "$RUST_DIR" \
--global-property models,supportingFiles \
--additional-properties=packageName=apollo-openapi,packageVersion=0.3.7
--additional-properties=packageName=apollo-openapi,packageVersion=0.3.8

echo "✅ SDK generation complete."

Expand Down
Loading
Loading