Copilot commented on code in PR #11260: URL: https://github.com/apache/gravitino/pull/11260#discussion_r3310499015
########## docs/open-api/idp/idp.yaml: ########## @@ -0,0 +1,480 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +--- + +paths: + + /idp/users: + post: + tags: + - idp + summary: Add built-in IdP user + description: > + Creates a built-in IdP user with the given username and password. + Requires the `basic` authenticator and the `idp-basic` plugin to be enabled. + operationId: addIdpUser + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddUserRequest" + examples: + AddUserRequest: + $ref: "#/components/examples/AddUserRequest" + responses: + "200": + description: Returns the added built-in IdP user + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP user already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" Review Comment: OpenAPI response code pattern keys are case-sensitive; `"5xx"` is not a valid range key in OAS3 (expected `"5XX"`), and many validators will reject it. Consider using `"5XX"` for a range, or use `"default"` if the intent is “any unexpected server error.” ########## docs/open-api/idp/idp.yaml: ########## @@ -0,0 +1,480 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +--- + +paths: + + /idp/users: + post: + tags: + - idp + summary: Add built-in IdP user + description: > + Creates a built-in IdP user with the given username and password. + Requires the `basic` authenticator and the `idp-basic` plugin to be enabled. + operationId: addIdpUser + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddUserRequest" + examples: + AddUserRequest: + $ref: "#/components/examples/AddUserRequest" + responses: + "200": + description: Returns the added built-in IdP user + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" Review Comment: `content.<mediaType>.schema` must reference a Schema Object, but `#/components/responses/IdpUserResponse` points to a Response Object location (and later is defined like a schema). This will fail OpenAPI validation/tooling. Fix by either (a) moving `IdpUserResponse`/`IdpGroupResponse` under `components/schemas` and referencing `#/components/schemas/...` from `schema:`, or (b) defining proper `components/responses/IdpUserResponse` as a Response Object (with `description` + `content`) and then `$ref` it at the response level (e.g., under `"200":`). ########## docs/open-api/idp/idp.yaml: ########## @@ -0,0 +1,480 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +--- + +paths: + + /idp/users: + post: + tags: + - idp + summary: Add built-in IdP user + description: > + Creates a built-in IdP user with the given username and password. + Requires the `basic` authenticator and the `idp-basic` plugin to be enabled. + operationId: addIdpUser + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddUserRequest" + examples: + AddUserRequest: + $ref: "#/components/examples/AddUserRequest" + responses: + "200": + description: Returns the added built-in IdP user + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP user already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/users/{user}: + parameters: + - $ref: "../openapi.yaml#/components/parameters/user" + + get: + tags: + - idp + summary: Get built-in IdP user + description: Returns the specified built-in IdP user, including group membership. + operationId: getIdpUser + responses: + "200": + description: Returns the built-in IdP user object + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + put: + tags: + - idp + summary: Change built-in IdP user password + description: Updates the password of the specified built-in IdP user. + operationId: changeIdpUserPassword + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ChangePasswordRequest" + examples: + ChangePasswordRequest: + $ref: "#/components/examples/ChangePasswordRequest" + responses: + "200": + description: Returns the built-in IdP user after the password change + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - idp + summary: Remove built-in IdP user + operationId: removeIdpUser + responses: + "200": + $ref: "../openapi.yaml#/components/responses/RemoveResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups: + post: + tags: + - idp + summary: Add built-in IdP group + description: Creates a built-in IdP group with the given name. + operationId: addIdpGroup + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddGroupRequest" + examples: + AddGroupRequest: + $ref: "#/components/examples/AddGroupRequest" + responses: + "200": + description: Returns the added built-in IdP group + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP group already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups/{group}: + parameters: + - $ref: "../openapi.yaml#/components/parameters/group" + + get: + tags: + - idp + summary: Get built-in IdP group + description: Returns the specified built-in IdP group, including member usernames. + operationId: getIdpGroup + responses: + "200": + description: Returns the built-in IdP group object + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - idp + summary: Remove built-in IdP group + operationId: removeIdpGroup + parameters: + - $ref: "../openapi.yaml#/components/parameters/force" + responses: + "200": + $ref: "../openapi.yaml#/components/responses/RemoveResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups/{group}/users: + parameters: + - $ref: "../openapi.yaml#/components/parameters/group" + + put: + tags: + - idp + summary: Change built-in IdP group membership + description: > + Adds and/or removes users from the specified built-in IdP group in a single request, + similar to tag association. At least one of `usersToAdd` or `usersToRemove` must be set. + operationId: changeIdpGroupMembership + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/GroupMembershipChangeRequest" + examples: + GroupMembershipChangeRequest: + $ref: "#/components/examples/GroupMembershipChangeRequest" + responses: + "200": + description: Returns the built-in IdP group after membership changes + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group or user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + +components: + schemas: + IdpUser: + type: object + required: + - name + properties: + name: + type: string + description: The username of the built-in IdP user + groups: + type: array + items: + type: string + description: The built-in IdP groups the user belongs to + + IdpGroup: + type: object + required: + - name + properties: + name: + type: string + description: The name of the built-in IdP group + users: + type: array + items: + type: string + description: The usernames of members in the built-in IdP group + + AddUserRequest: + type: object + required: + - user + - password + properties: + user: + type: string + description: The username of the built-in IdP user to add + password: + type: string + format: password + description: The password of the built-in IdP user to add + writeOnly: true + + ChangePasswordRequest: + type: object + required: + - password + properties: + password: + type: string + format: password + description: The new password of the built-in IdP user + writeOnly: true + + AddGroupRequest: + type: object + required: + - group + properties: + group: + type: string + description: The name of the built-in IdP group to add + + GroupMembershipChangeRequest: + type: object + properties: + usersToAdd: + type: array + items: + type: string + description: The usernames to add to the built-in IdP group + nullable: true + usersToRemove: + type: array + items: + type: string + description: The usernames to remove from the built-in IdP group + nullable: true + + responses: + IdpUserResponse: + type: object + properties: + code: + type: integer Review Comment: Items under `components/responses` must be OpenAPI Response Objects (e.g., `description`, optional `headers`, `content`, etc.), not schema definitions with `type:`/`properties:`. To make this spec valid, define these payload shapes under `components/schemas` (e.g., `IdpUserResponseBody`) and optionally create reusable Response Objects under `components/responses` that wrap the schema via `content`. ########## docs/open-api/idp/idp.yaml: ########## @@ -0,0 +1,480 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +--- + +paths: + + /idp/users: + post: + tags: + - idp + summary: Add built-in IdP user + description: > + Creates a built-in IdP user with the given username and password. + Requires the `basic` authenticator and the `idp-basic` plugin to be enabled. + operationId: addIdpUser + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddUserRequest" + examples: + AddUserRequest: + $ref: "#/components/examples/AddUserRequest" + responses: + "200": + description: Returns the added built-in IdP user + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP user already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/users/{user}: + parameters: + - $ref: "../openapi.yaml#/components/parameters/user" + + get: + tags: + - idp + summary: Get built-in IdP user + description: Returns the specified built-in IdP user, including group membership. + operationId: getIdpUser + responses: + "200": + description: Returns the built-in IdP user object + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + put: + tags: + - idp + summary: Change built-in IdP user password + description: Updates the password of the specified built-in IdP user. + operationId: changeIdpUserPassword + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ChangePasswordRequest" + examples: + ChangePasswordRequest: + $ref: "#/components/examples/ChangePasswordRequest" + responses: + "200": + description: Returns the built-in IdP user after the password change + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - idp + summary: Remove built-in IdP user + operationId: removeIdpUser + responses: + "200": + $ref: "../openapi.yaml#/components/responses/RemoveResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups: + post: + tags: + - idp + summary: Add built-in IdP group + description: Creates a built-in IdP group with the given name. + operationId: addIdpGroup + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddGroupRequest" + examples: + AddGroupRequest: + $ref: "#/components/examples/AddGroupRequest" + responses: + "200": + description: Returns the added built-in IdP group + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP group already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups/{group}: + parameters: + - $ref: "../openapi.yaml#/components/parameters/group" + + get: + tags: + - idp + summary: Get built-in IdP group + description: Returns the specified built-in IdP group, including member usernames. + operationId: getIdpGroup + responses: + "200": + description: Returns the built-in IdP group object + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - idp + summary: Remove built-in IdP group + operationId: removeIdpGroup + parameters: + - $ref: "../openapi.yaml#/components/parameters/force" + responses: + "200": + $ref: "../openapi.yaml#/components/responses/RemoveResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups/{group}/users: + parameters: + - $ref: "../openapi.yaml#/components/parameters/group" + + put: + tags: + - idp + summary: Change built-in IdP group membership + description: > + Adds and/or removes users from the specified built-in IdP group in a single request, + similar to tag association. At least one of `usersToAdd` or `usersToRemove` must be set. + operationId: changeIdpGroupMembership + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/GroupMembershipChangeRequest" + examples: + GroupMembershipChangeRequest: + $ref: "#/components/examples/GroupMembershipChangeRequest" + responses: + "200": + description: Returns the built-in IdP group after membership changes + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group or user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + +components: + schemas: + IdpUser: + type: object + required: + - name + properties: + name: + type: string + description: The username of the built-in IdP user Review Comment: The same concept is named `name` in `IdpUser` but `user` in `AddUserRequest` (and similarly `IdpGroup.name` vs `AddGroupRequest.group`). This inconsistency makes client generation and API usage more error-prone. Prefer standardizing field names across request/response payloads (e.g., use `name` everywhere, or use `user`/`group` consistently and map accordingly). ########## docs/open-api/idp/idp.yaml: ########## @@ -0,0 +1,480 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +--- + +paths: + + /idp/users: + post: + tags: + - idp + summary: Add built-in IdP user + description: > + Creates a built-in IdP user with the given username and password. + Requires the `basic` authenticator and the `idp-basic` plugin to be enabled. + operationId: addIdpUser + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddUserRequest" + examples: + AddUserRequest: + $ref: "#/components/examples/AddUserRequest" + responses: + "200": + description: Returns the added built-in IdP user + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP user already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/users/{user}: + parameters: + - $ref: "../openapi.yaml#/components/parameters/user" + + get: + tags: + - idp + summary: Get built-in IdP user + description: Returns the specified built-in IdP user, including group membership. + operationId: getIdpUser + responses: + "200": + description: Returns the built-in IdP user object + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + put: + tags: + - idp + summary: Change built-in IdP user password + description: Updates the password of the specified built-in IdP user. + operationId: changeIdpUserPassword + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ChangePasswordRequest" + examples: + ChangePasswordRequest: + $ref: "#/components/examples/ChangePasswordRequest" + responses: + "200": + description: Returns the built-in IdP user after the password change + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - idp + summary: Remove built-in IdP user + operationId: removeIdpUser + responses: + "200": + $ref: "../openapi.yaml#/components/responses/RemoveResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups: + post: + tags: + - idp + summary: Add built-in IdP group + description: Creates a built-in IdP group with the given name. + operationId: addIdpGroup + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddGroupRequest" + examples: + AddGroupRequest: + $ref: "#/components/examples/AddGroupRequest" + responses: + "200": + description: Returns the added built-in IdP group + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP group already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups/{group}: + parameters: + - $ref: "../openapi.yaml#/components/parameters/group" + + get: + tags: + - idp + summary: Get built-in IdP group + description: Returns the specified built-in IdP group, including member usernames. + operationId: getIdpGroup + responses: + "200": + description: Returns the built-in IdP group object + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - idp + summary: Remove built-in IdP group + operationId: removeIdpGroup + parameters: + - $ref: "../openapi.yaml#/components/parameters/force" + responses: + "200": + $ref: "../openapi.yaml#/components/responses/RemoveResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups/{group}/users: + parameters: + - $ref: "../openapi.yaml#/components/parameters/group" + + put: + tags: + - idp + summary: Change built-in IdP group membership + description: > + Adds and/or removes users from the specified built-in IdP group in a single request, + similar to tag association. At least one of `usersToAdd` or `usersToRemove` must be set. + operationId: changeIdpGroupMembership + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/GroupMembershipChangeRequest" + examples: + GroupMembershipChangeRequest: + $ref: "#/components/examples/GroupMembershipChangeRequest" + responses: + "200": + description: Returns the built-in IdP group after membership changes + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group or user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + +components: + schemas: + IdpUser: + type: object + required: + - name + properties: + name: + type: string + description: The username of the built-in IdP user + groups: + type: array + items: + type: string + description: The built-in IdP groups the user belongs to + + IdpGroup: + type: object + required: + - name + properties: + name: + type: string + description: The name of the built-in IdP group + users: + type: array + items: + type: string + description: The usernames of members in the built-in IdP group + + AddUserRequest: + type: object + required: + - user + - password + properties: + user: + type: string + description: The username of the built-in IdP user to add + password: + type: string + format: password + description: The password of the built-in IdP user to add + writeOnly: true + + ChangePasswordRequest: + type: object + required: + - password + properties: + password: + type: string + format: password + description: The new password of the built-in IdP user + writeOnly: true + + AddGroupRequest: + type: object + required: + - group + properties: + group: + type: string + description: The name of the built-in IdP group to add + + GroupMembershipChangeRequest: + type: object + properties: + usersToAdd: + type: array + items: + type: string + description: The usernames to add to the built-in IdP group + nullable: true + usersToRemove: + type: array + items: + type: string + description: The usernames to remove from the built-in IdP group + nullable: true Review Comment: The description states at least one of `usersToAdd` or `usersToRemove` must be set, but the schema currently permits requests with neither field, and also explicitly permits `null` arrays (which conflicts with “must be set” semantics). Enforce this contract in the schema using `anyOf` + `required` (and optionally `minItems: 1`), and consider removing `nullable: true` unless `null` is intentionally supported by the API. ########## docs/open-api/idp/idp.yaml: ########## @@ -0,0 +1,480 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +--- + +paths: + + /idp/users: + post: + tags: + - idp + summary: Add built-in IdP user + description: > + Creates a built-in IdP user with the given username and password. + Requires the `basic` authenticator and the `idp-basic` plugin to be enabled. + operationId: addIdpUser + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddUserRequest" + examples: + AddUserRequest: + $ref: "#/components/examples/AddUserRequest" + responses: + "200": + description: Returns the added built-in IdP user + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP user already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/users/{user}: + parameters: + - $ref: "../openapi.yaml#/components/parameters/user" + + get: + tags: + - idp + summary: Get built-in IdP user + description: Returns the specified built-in IdP user, including group membership. + operationId: getIdpUser + responses: + "200": + description: Returns the built-in IdP user object + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + put: + tags: + - idp + summary: Change built-in IdP user password + description: Updates the password of the specified built-in IdP user. + operationId: changeIdpUserPassword + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ChangePasswordRequest" + examples: + ChangePasswordRequest: + $ref: "#/components/examples/ChangePasswordRequest" + responses: + "200": + description: Returns the built-in IdP user after the password change + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpUserResponse" + examples: + IdpUserResponse: + $ref: "#/components/examples/IdpUserResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - idp + summary: Remove built-in IdP user + operationId: removeIdpUser + responses: + "200": + $ref: "../openapi.yaml#/components/responses/RemoveResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups: + post: + tags: + - idp + summary: Add built-in IdP group + description: Creates a built-in IdP group with the given name. + operationId: addIdpGroup + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AddGroupRequest" + examples: + AddGroupRequest: + $ref: "#/components/examples/AddGroupRequest" + responses: + "200": + description: Returns the added built-in IdP group + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "409": + description: Conflict - The built-in IdP group already exists + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + AlreadyExistsException: + $ref: "#/components/examples/IdpAlreadyExistsException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups/{group}: + parameters: + - $ref: "../openapi.yaml#/components/parameters/group" + + get: + tags: + - idp + summary: Get built-in IdP group + description: Returns the specified built-in IdP group, including member usernames. + operationId: getIdpGroup + responses: + "200": + description: Returns the built-in IdP group object + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - idp + summary: Remove built-in IdP group + operationId: removeIdpGroup + parameters: + - $ref: "../openapi.yaml#/components/parameters/force" + responses: + "200": + $ref: "../openapi.yaml#/components/responses/RemoveResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + + /idp/groups/{group}/users: + parameters: + - $ref: "../openapi.yaml#/components/parameters/group" + + put: + tags: + - idp + summary: Change built-in IdP group membership + description: > + Adds and/or removes users from the specified built-in IdP group in a single request, + similar to tag association. At least one of `usersToAdd` or `usersToRemove` must be set. + operationId: changeIdpGroupMembership + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/GroupMembershipChangeRequest" + examples: + GroupMembershipChangeRequest: + $ref: "#/components/examples/GroupMembershipChangeRequest" + responses: + "200": + description: Returns the built-in IdP group after membership changes + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "#/components/responses/IdpGroupResponse" + examples: + IdpGroupResponse: + $ref: "#/components/examples/IdpGroupResponse" + "400": + $ref: "../openapi.yaml#/components/responses/BadRequestErrorResponse" + "403": + $ref: "#/components/responses/IdpForbiddenErrorResponse" + "404": + description: Not Found - The specified built-in IdP group or user does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "../openapi.yaml#/components/schemas/ErrorModel" + examples: + NotFoundException: + $ref: "#/components/examples/IdpNotFoundException" + "5xx": + $ref: "../openapi.yaml#/components/responses/ServerErrorResponse" + +components: + schemas: + IdpUser: + type: object + required: + - name + properties: + name: + type: string + description: The username of the built-in IdP user + groups: + type: array + items: + type: string + description: The built-in IdP groups the user belongs to + + IdpGroup: + type: object + required: + - name + properties: + name: + type: string + description: The name of the built-in IdP group + users: + type: array + items: + type: string + description: The usernames of members in the built-in IdP group + + AddUserRequest: + type: object + required: + - user + - password + properties: + user: + type: string + description: The username of the built-in IdP user to add Review Comment: The same concept is named `name` in `IdpUser` but `user` in `AddUserRequest` (and similarly `IdpGroup.name` vs `AddGroupRequest.group`). This inconsistency makes client generation and API usage more error-prone. Prefer standardizing field names across request/response payloads (e.g., use `name` everywhere, or use `user`/`group` consistently and map accordingly). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
