Skip to content

Commit 90997ac

Browse files
authored
Merge branch 'main' into CLOUDP-366822
2 parents 11fb690 + d408eba commit 90997ac

File tree

10 files changed

+92
-47
lines changed

10 files changed

+92
-47
lines changed

ipa/general/0106.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Adopt
1919

2020
- APIs **should** provide a create method for resources unless it is not
2121
valuable for users to do so
22+
- [Read-only resources](0101.md#read-only-resources) **must not** have a
23+
Create method
24+
- [Singleton resources](0113.md) **must not** have a Create method
2225
- The purpose of the create method is to create a new resource in a collection
2326
- The HTTP verb **must** be
2427
[`POST`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST)

ipa/general/0107.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Adopt
1919

2020
- APIs **should** provide an update method for resources unless it is not
2121
valuable for users to do so
22+
- [Read-only resources](0101.md#read-only-resources) **must not** have an
23+
Update method
24+
- [Read-only singleton resources](0113.md#read-only-singleton-resources)
25+
**must not** have an Update method
2226
- The purpose of the Update method is to make changes to the resources without
2327
causing side effects
2428
- The HTTP verb **should** be

ipa/general/0108.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Adopt
1919

2020
- APIs **should** provide a Delete method for resources unless it is not
2121
valuable for users to do so
22+
- [Read-only resources](0101.md#read-only-resources) **must not** have a
23+
Delete method
24+
- [Singleton resources](0113.md) **must not** have a Delete method
2225
- The HTTP verb **must** be
2326
[`DELETE`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE)
2427
- The response **should** be empty

ipa/general/0109.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ POST /groups/${groupId}/clusters/${clusterName}:removeNode
6464

6565
### Declarative-friendly resources
6666

67-
- Declarative-friendly resources **must not** use custom methods. To learn more,
68-
see [IPA-127](0127.md).
67+
- Declarative-friendly resources **should not** use custom methods. To learn
68+
more, see [IPA-127](0127.md).
6969
- Custom methods require manual curation, implementation, and review for API
7070
tooling, which increases feature latency.
7171
- Declarative-friendly tools are unable to automatically determine what to do

ipa/general/0111.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ may modify and return values are complex, not public, and not repeatable.
1212

1313
:::warning[State]
1414

15-
Experimental
15+
Adopt
1616

1717
:::
1818

ipa/general/0113.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,22 @@ modified by API consumers.
5353
- Unsupported operations on read-only singleton resources **should** return
5454
`405 Not Allowed`
5555
- Unsupported operations **must not** be documented
56+
57+
### Resetting Singleton Resources
58+
59+
Singleton resources can be restored to their default state without deleting the
60+
parent resource. For such cases, a `:reset` [custom method](0109.md) **must** be
61+
used.
62+
63+
- The `:reset` custom method name **must** be reserved exclusively for restoring
64+
singleton resources to their default state
65+
- The `:reset` custom method **must** use the `POST` HTTP method
66+
- The `:reset` custom method **must** be idempotent
67+
- Calling reset multiple times **must** produce the same result as calling it
68+
once
69+
- The `:reset` custom method **must** return a
70+
[200 OK](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200)
71+
response with the reset resource in the response body
72+
- The `:reset` custom method **must not** have a request body
73+
- Read-only singleton resources **must not** define a `:reset` custom method
74+
- Read-only singleton resources cannot be modified, so reset is not applicable

ipa/general/0114.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,8 @@ Adopt
2424
validations and exposing the appropriate error user error (4XX)
2525
- Errors **must** use the canonical error codes allowed for the `errorCode`
2626
field
27-
- APIs **should** make the best effort to validate as much as possible of the
28-
request and include all validation errors in the field `badRequestDetail`
29-
- `badRequestDetail` **must** include an array of fields and each field
30-
**must** include:
31-
- the error description as `description`
32-
- field with errors as `field`
33-
- APIs **should** make the best effort to help customers with possible next
34-
steps in case of an error by adding the help field
27+
- APIs **may** make the best effort to help customers with possible next steps
28+
in case of an error by adding a `help` field
3529
- `help` **must** include a short description as description
3630
- `help` **must** include a link to the documentation url
3731
- [Methods](0103.md) **must** document any possible error and their associated
@@ -78,6 +72,30 @@ are treated as `404 Not Found` rather than `400 Bad Request`.
7872
limit window
7973

8074
:::
75+
### Validation Errors
76+
77+
Validation errors occur when the client sends a request that does not meet the
78+
API's requirements. Proper validation is critical for maintaining data integrity
79+
and providing clear feedback to clients.
80+
81+
Validation errors typically occur when:
82+
83+
- Required fields are missing
84+
- Data types don't match expected formats
85+
- Values fall outside acceptable ranges
86+
- Business rules are violated
87+
88+
- APIs **must** return a `400 Bad Request` status code when validation fails
89+
- APIs **must not** accept invalid requests and silently modify field values to
90+
make them valid
91+
- This violates the principle that client-owned fields must not be modified by
92+
the server (see [IPA-111](0111.md#single-owner-fields))
93+
- APIs **should** make the best effort to validate as much as possible of the
94+
request and include all validation errors in the field `badRequestDetail`
95+
- `badRequestDetail` **must** include an array of fields and each field
96+
**must** include:
97+
- the error description as `description`
98+
- field with errors as `field`
8199

82100
### API Error Format
83101

ipa/general/0116.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Changes considered non-breaking include:
6565
- Response headers **may** be added to existing versions
6666
- Changes to a resources authorization **may** be added to existing versions
6767
- New options **may** be added to existing enums
68+
- Input and output fields **may** be marked as deprecated in existing versions
6869

6970
### Semantic Breaking Changes
7071

ipa/general/0117.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ Operation summaries are titles describing an API operation.
152152
- API Producers **must** use only one main action verb e.g. "Create," "Update,"
153153
"Delete," "Add," "Remove"
154154
- API Producers **must** use "Update" instead of "Modify" or "Change"
155+
- API Producers **must** use "Reset" when the operation is restoring a resource
156+
to its default state
157+
- E.g. "Reset Project Settings for One MongoDB Cloud User"
155158
- API Producers **must** use "in" for actions operating within the parent
156159
(retrieving, updating, creating) and "from" for removing/disassociating
157160
- "Remove One MongoDB Cloud User from One Project" instead of "Remove One

ipa/general/0127.md

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ slug: /127
77

88
:::warning[State]
99

10-
Experimental
10+
Adopt
1111

1212
:::
1313

@@ -17,51 +17,33 @@ such as **Infrastructure as Code (IaC) tools**, which many customers heavily
1717
depend on for their DevOps workflows.\
1818
An interface is considered "declarative-friendly" when resources can be managed
1919
by specifying their **desired final state**, rather than outlining a series of
20-
steps or actions. In this approach, you define **what** the resource should look
21-
like, while the API takes care of the **how**.
20+
steps or actions. In this approach, a user defines **what** the resource should
21+
look like via an IaC tool, while the tool and underlying API take care of the
22+
**how**.
2223

2324
With the wide range of popular IaC tools and the constant demand to integrate
2425
diverse resource types across multiple platforms, **uniformity** is critical to
2526
fully automating these integrations.\
26-
The following guidance is to enable interfaces to be **declarative-friendly**
27-
and support **automation**.
27+
28+
:::warning[Important]
29+
30+
In addition to the existing guidelines, **declarative-friendly** interfaces
31+
require extra, stricter guidance to support IaC tooling automation.
32+
33+
:::
2834

2935
## Guidance
3036

3137
- A resource **must** be strongly consistent with the **Resource-Oriented
3238
Design** ([IPA-101](0101.md))
33-
- An interface **must** expose the full resource lifecycle using standard HTTP
34-
verbs. The `GET` operation is critical for IaC tools to read the current
35-
state and compare it against the desired state.
36-
- A resource **must** have `CREATE`, `DELETE`, `GET`, `LIST` and `UPDATE`
37-
methods, except for [read-only resources](#read-only-resources) which **must**
38-
have only `GET` and `LIST` methods.
39-
- Response schemas of `CREATE`, `GET` and `UPDATE` **must** be the same
40-
- Fields defined in `CREATE` and `UPDATE` request schemas **should be** the
41-
same and **should** be present in response schema
42-
- For full guidance, see [IPA-103](0103.md), [IPA-104](0104.md),
43-
[IPA-105](0105.md), [IPA-106](0106.md), [IPA-107](0107.md),
44-
[IPA-108](0108.md)
45-
- A resource **must not** have custom methods ([IPA-109](0109.md)) as they make
46-
some automations impossible. Any deviation from this guidance requires a
39+
- A resource **must** have `CREATE`, `DELETE`, `GET`, `LIST` methods, except for
40+
[singleton resources](0113.md) and
41+
[read-only resources](0101.md#read-only-resources) which **must** have `GET`
42+
and `LIST` methods.
43+
- A resource **should not** have custom methods ([IPA-109](0109.md)). Any
44+
complementary functionality of a resource exposed through custom methods will
45+
not be supported through automation. Deviation from this guidance requires a
4746
strong justification and review by the governing API body.
48-
- A resource field **must** have a single owner ([IPA-111](0111.md))
49-
- Effective fields **must** be used when a client-owned field can also be
50-
controlled by the server
51-
- A resource field name **must** be consistent in between the request, response
52-
body and path parameters ([IPA-112](0112.md))
53-
- A resource **must** have a standardized error format so that consumers can
54-
fully rely on understandable API responses ([IPA-114](0114.md))
55-
- A resource field **should** have a single type ([IPA-125](0125.md))
56-
57-
### Read-Only Resources
58-
59-
[Read-only resources](0101.md#read-only-resources) are declarative-friendly when
60-
they provide observable state that IaC tools need to reference or depend upon.
61-
62-
For full guidance on read-only resources, see
63-
[IPA-101](0101.md#read-only-resources). For read-only singleton resources, see
64-
[IPA-113](0113.md#read-only-singleton-resources).
6547

6648
### Motivation and Strategic Goals
6749

@@ -76,3 +58,15 @@ are predictably declarative, we can build automations that create and maintain
7658
tools such as our Terraform and CloudFormation providers. This will dramatically
7759
accelerate the availability of IaC support for our products and reduce manual,
7860
error-prone development.
61+
62+
### Further Reading
63+
64+
- [IPA-101: Resource-Oriented Design](0101.md)
65+
- [IPA-104: Get](0104.md)
66+
- [IPA-105: List](0105.md)
67+
- [IPA-106: Create](0106.md)
68+
- [IPA-108: Delete](0108.md)
69+
- [IPA-109: Custom Methods](0109.md)
70+
- [IPA-111: Server-Modified Values and Defaults](0111.md)
71+
- [IPA-114: Errors](0114.md)
72+
- [IPA-125: Single Type in Request and Response](0125.md)

0 commit comments

Comments
 (0)