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

Add security create user 201 response to OpenAPI spec #810

Merged
merged 4 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added a warning for test file names that don't match the API being tested ([#793](https://github.com/opensearch-project/opensearch-api-specification/pull/793))
- Added `time` field to the `GetStats` schema in `_common.yml` ([#803](https://github.com/opensearch-project/opensearch-api-specification/pull/803))
- Added version for `POST /_plugins/_ml/_train/{algorithm_name}`, `_predict/{algorithm_name}/{model_id}`, and `_train_predict/{algorithm_name}` ([#763](https://github.com/opensearch-project/opensearch-api-specification/pull/763))
- Added `POST _plugins/_security/api/internalusers/{username}` response `201` [#810](https://github.com/opensearch-project/opensearch-api-specification/pull/810)
Copy link
Member

Choose a reason for hiding this comment

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

Match the format of other lines.

Suggested change
- Added `POST _plugins/_security/api/internalusers/{username}` response `201` [#810](https://github.com/opensearch-project/opensearch-api-specification/pull/810)
- Added `POST _plugins/_security/api/internalusers/{username}` response `201` ([#810](https://github.com/opensearch-project/opensearch-api-specification/pull/810))

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure thanks! Just updated.


### Removed
- Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652))
Expand Down
7 changes: 7 additions & 0 deletions spec/namespaces/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ paths:
responses:
'200':
$ref: '#/components/responses/security.create_user@200'
'201':
$ref: '#/components/responses/security.create_user@201'
patch:
operationId: security.patch_user.0
x-operation-group: security.patch_user
Expand Down Expand Up @@ -1657,6 +1659,11 @@ components:
application/json:
schema:
$ref: '../schemas/security._common.yaml#/components/schemas/Ok'
security.create_user@201:
content:
application/json:
schema:
$ref: '../schemas/security._common.yaml#/components/schemas/Created'
security.create_user_legacy@200:
content:
application/json:
Expand Down
19 changes: 16 additions & 3 deletions tests/default/security/api/internalusers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,31 @@ chapters:
method: GET
response:
status: 200
- synopsis: Create internal user for first time.
path: /_plugins/_security/api/internalusers/{username}
method: PUT
parameters:
username: test
request:
payload:
password: myWeakPassword123!
opendistro_security_roles: []
backend_roles: []
attributes: {}
response:
status: 201
- synopsis: Patch internal users bulk.
path: /_plugins/_security/api/internalusers
method: PATCH
request:
payload:
payload:
- op: add
path: /test
value:
value:
backend_roles: [admin]
response:
status: 200
- synopsis: Create internal user.
- synopsis: Create internal user with existing name.
path: /_plugins/_security/api/internalusers/{username}
method: PUT
parameters:
Expand Down