-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docs): policy service contribution docs (#1842)
### Proposed Changes * Adds a contributing guide to the various policy services linking to existing documentation as appropriate or providing current conventions ### Checklist - [ ] I have added or updated unit tests - [ ] I have added or updated integration tests (if appropriate) - [ ] I have added or updated documentation ### Testing Instructions --------- Co-authored-by: Ryan Yanulites <[email protected]>
- Loading branch information
1 parent
be5d817
commit 700b94d
Showing
3 changed files
with
123 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Contributing to Policy | ||
|
||
Policy in OpenTDF comprises a set of CRUD services rolled up into a single "policy" service | ||
registered to the OpenTDF platform. | ||
|
||
Each Policy Object is linked relationally at the database level (currently PostgreSQL), and | ||
there are conventions to the services and codebase. | ||
|
||
## Database | ||
|
||
See the [database readme](./db/README.md) for context. | ||
|
||
## Protos | ||
|
||
New policy protos are expected to follow the following conventions (provided as a checklist for development | ||
convenience). | ||
|
||
- [ ] Fields are validated by in-proto validators as much as possible (reducing in-service validation logic). | ||
- [ ] Unit tests are written for the validation (see [./attributes/attributes_test.go](./attributes/attributes_test.go)) | ||
- [ ] Proto fields: | ||
- [ ] order required fields first, optional after | ||
- [ ] document required fields as `// Required` and optional as `// Optional` | ||
- [ ] reserve a reasonable number of field indexes for required (i.e. 1-100 used for required, 100+ are used for optional) | ||
- [ ] Pagination follows conventions laid out [in the ADR](./adr/0002-pagination-list-rpcs.md) | ||
|
||
## Services | ||
|
||
- [ ] CRUD RPCs for Policy objects that retroactively affect access to existing TDFs are served by the [`unsafe` service](./unsafe/) | ||
- [ ] Audit records follow the conventions [in the ADR](./adr/0000-current-state.md) | ||
- [ ] CRUD RPCs that affect multiple objects employ transactions as documented [in the ADR](./adr/0003-database-transactions.md) | ||
- [ ] Any write RPCs either employ a transaction for a read after write scenario, or populate responses from initial request + RETURNING | ||
clauses in SQL (proactively avoiding potential data consistency issues at future scale) | ||
- [ ] Pagination follows conventions laid out [in the ADR](./adr/0002-pagination-list-rpcs.md) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters