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
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ install:
# Run linting with prettier
lint: install
npx prettier --check **/*.md
npm run lint:validate-patterns

# Format files with prettier
format: install

# Fix all files automatically, best effort.
fix: install
npx prettier --write **/*.md
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ Common types used in AEPs
aep.dev has registered the extension ids 1264-1274 with the [global extension registry](https://github.com/protocolbuffers/protobuf/blob/main/docs/options.md). Any extensions added to this project should use these values.

To minimize the need to add new ids to the global registry, additions should try to re-use the existing extensions as much as possible (for example, additional field annotations should be added as fields to `aep.api.field_info`).

### Quick Start

```bash
# lint
make lint

# fix as best as possible
make fix
```
21 changes: 13 additions & 8 deletions json_schema/extensions/x-aep-resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,22 @@ properties:
items:
type: string
# see https://aep.dev/4/#type-name
pattern: "^[a-z0-9][.-a-z0-9/]*[a-z0-9]$"
examples:
- "library.example.com/author"
- "library.example.com/user-profile"
pattern: "^[a-z0-9][a-z0-9.-]*/[a-z0-9][-a-z0-9]*$"
examples:
- "library.example.com/author"
- "library.example.com/user-profile"
patterns:
type: array
description: The resource name patterns that are valid for this resource
items:
type: string
pattern: "^[a-z][a-z0-9-]*/\\{[a-z][a-z0-9-]*\\}(/[a-z][a-z0-9-]*/\\{[a-z][a-z0-9-]*\\})*$"
# see https://aep.dev/4/#annotating-resource-types
# this asserts for a leading collection name and pairs of collection, id segments.
pattern: "^[a-z][a-z0-9-]*(/\\{[a-z][a-z0-9_]*\\}|[a-z][a-z0-9-])*" # WIP
examples:
- "books/{book_id}"
- "authors/{author_id}/books/{book_id}"
- "authors/{author_id}/books/{book_id}"
minItems: 1
singleton:
type: boolean
Expand All @@ -44,9 +50,8 @@ properties:
description: >
The type of resource, in the form of `{api name}.{resource singular}`.
For example, `api.examples.com/user`.
pattern:
"^[a-z0-9][.-a-z0-9/]*[a-z0-9]$"
# see https://aep.dev/4/#type-name
# see https://aep.dev/4/#type-name
pattern: "^[a-z0-9][a-z0-9_.]*/[a-z0-9][-a-z0-9]*$"
examples:
- "library.example.com/book"
- "library.example.com/author"
Expand Down
Loading