Skip to content

Commit

Permalink
[media-type] Initialize >>
Browse files Browse the repository at this point in the history
- Add domain main type specs
- Combine some other specs to use Media Type URI instead use of URN
  • Loading branch information
OmidHekayati committed Feb 8, 2022
1 parent ff946a1 commit 4b1c442
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
9 changes: 0 additions & 9 deletions Data-Structure.md

This file was deleted.

9 changes: 0 additions & 9 deletions Error.md

This file was deleted.

10 changes: 0 additions & 10 deletions Service.md

This file was deleted.

33 changes: 33 additions & 0 deletions media-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Media Type Extension
Want a protocol to declare global service, error, ... in any language with desire goals, So we decide to add new main-type to media-type URI scheme instead invent from scratch. Add new top-level type names (main-type) as `domain` instead of `application` to have proper way to indicate domain specific media types.

## Structure
`type "/" [tree "."] subtype ["+" suffix]* [";" parameters]`
`domain/{{domain-name}}. {{structure-type}} +{{codec-type}} ;{{structure-name}}`
`domain/sabz.city.storage+syllab; quiddity`
- **domain-name** as a tree for a organization by its domain name.
- **structure-type** or structure scope like `storage`, `service`, `error`, `page`, `widget`, ...
- **codec-type** like `syllab`, `json`, `xml`, `protobuf`, `flatbuf`, `html`, ...
- **structure-name** must be unique in the domain scope e.g. "product" in the "page" scope of the domain. e.g. `log`, `get-email`, `get-email`, `request`, `response`, `not-standard-structure-id`, ... Due to RFC rules, a media-type can has more than one parameters, so you can easily add more than one if need it like http that use `charset=` and `boundary=` in content-type header.

## ID
- To have canonical structure IDs calculate it from hash of MediaType().
- ID is first 64bit of SHA3-256 hash of structure that transfer in base64 if protocol is string base.
- Zero ID means no data structure e.g. no error, ....

## Goals
- Easily generate SDK in any programing language
- Transfer and retrieve by ID in any protocol
- Store locale detail not just english detail
-

## Other ways
- use URN standard like `urn:giti:sabz.city:page:login` as `urn:giti:{{domain-name}}:{{structure-type}}:{{structure-name}}`

## RFCs
- https://datatracker.ietf.org/doc/html/rfc6838
- https://datatracker.ietf.org/doc/html/rfc2046
- https://datatracker.ietf.org/doc/html/rfc2609

## Resources
- https://en.wikipedia.org/wiki/Media_type

0 comments on commit 4b1c442

Please sign in to comment.