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

feat: add Components, Security Requirement(s) models and other improvements #71

Merged
merged 29 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6d47e9c
feat: add 'components' and 'correlationIds' models
smoya Aug 25, 2022
424660a
Update v1.md
smoya Aug 26, 2022
8f922db
Update v1.md
smoya Aug 26, 2022
f522013
Update v1.md
smoya Aug 26, 2022
7b9b575
add operations under components
smoya Aug 29, 2022
5897a1e
add Security Requirements
smoya Aug 29, 2022
3826e0b
fix security requirements
smoya Aug 30, 2022
50a267f
add missing MessageExample(s) model
smoya Aug 30, 2022
83703e6
remove hasKnownSchemaFormat
smoya Aug 30, 2022
b82a10f
add missing address and id to Channel
smoya Sep 1, 2022
eab44c2
simplify Traits since there is no clear use case
smoya Sep 2, 2022
1595275
add extensions() to bindings model
smoya Sep 6, 2022
1605ee1
cleanup models
smoya Sep 7, 2022
a3db4f3
add `filterByInUse()` and `filterByNotInUse()`
smoya Sep 15, 2022
eda0ef7
Merge branch 'master' into feat/components
smoya Sep 26, 2022
14cd75e
Remove filters by usage +add all* methods
smoya Oct 4, 2022
33e4025
remove empty lines
smoya Oct 5, 2022
1add6c4
Merge branch 'master' into feat/components
smoya Oct 5, 2022
0ae8f98
change schema.uid() method to schema.id()
smoya Oct 6, 2022
874fccd
Update docs/v1.md
smoya Oct 7, 2022
fb434bf
update README
smoya Oct 10, 2022
05af4ff
Merge branch 'master' into feat/components
smoya Oct 13, 2022
11e0919
Merge branch 'master' into feat/components
smoya Oct 20, 2022
e618297
Merge branch 'master' into feat/components
smoya Oct 27, 2022
835892a
Update docs/v1.md
smoya Oct 27, 2022
3a0c511
Merge branch 'master' into feat/components
smoya Nov 8, 2022
fc99a2a
add payload() to the Messages model and extension(id) method
magicmatatjahu Dec 20, 2022
fef1191
Merge branch 'master' into feat/components
magicmatatjahu Feb 2, 2023
dc68fe2
fix API
magicmatatjahu Feb 8, 2023
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
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# parser-api
Global API definition for all AsyncAPI Parser implementations.

The API follows an Intent-driven design approach, based on user intents rather than technical mechanics.
The API follows an Intent-driven design approach based on user intents rather than technical mechanics.

An **Intent** represents a user intention of performing an action that solves a clear use case.
An **Intent** represents a user's intention of performing an action that solves a clear use case.

For example, `Buy five watermelons` is the intent for `Going to the fruit shop, grab five watermelons, go to the counter, pay with cash, put the watermelon in a bag, exit the shop`.

Based on this principle, we have built an API based on the intents of the end-users, hiding the complexity of the tasks (do not care about going to the fruit shop, we do that for you) and providing better usability.
We tried to cover most use cases; however, we cannot think of every use case, so if you feel like the API is missing an intent, please create a feature request with it.
We tried to cover most use cases; however, we cannot think of every use case, so if you feel the API is missing an intent, please create a feature request with it.

Find all Parser API versions and definitions [here](docs).

Expand All @@ -17,34 +17,36 @@ Find all Parser API versions and definitions [here](docs).
Intents are wrapped in models. Models are spec-independent but based on AsyncAPI concepts that will always exist regardless of the specification version.

The upsides of using this approach are:
- Better user experience. Intents are much simple to use and do not force users to know about all spec internals.
- Better user experience. Intents are simple and do not force users to know about all spec internals.
- Improves resiliency to breaking changes on the final user code. Most of the time, users will **only** need to upgrade to the latest version of the parser to be up-to-date with the latest spec.

All individual parsers are following the intent API. Even though that the individual parsers maintain an individual release cycle, changes to the intent API will force the individual parsers to update as well.
> Say we release a new spec version and we are forced to create a breaking change and force a major version change for the intent API (say from version 2 -> 3) the individual parsers are then forced to make a major version change as well (say JS parser go from version 1 -> 2).
All individual parsers follow the intent API. Even though the individual parsers maintain an individual release cycle, changes to the intent API will force the individual parsers to update as well.
> Say we release a new spec version, and we are forced to create a breaking change and, therefore, force a major version release for the intent API (say from version 2 -> 3). Then, the individual parsers will be forced to release a major version as well (i.e. parser-go from version 1 -> 2).

Each parser will therefore maintain its own compatibility matrix between which specification and intent API versions are supported in which parser version.

### Models

These are the models in the intent API:
- **AsyncAPI** is the root model. Most of the intents are here, so users don't need to navigate through the object hierarchy.
These are the most important models in this API:
- **AsyncAPIDocument** is the root model. Most of the intents are here, so users don't need to navigate through the object hierarchy.
- **Binding** is a mechanism to define protocol-specific information.
- **Channel** describes a `topic`/`channel` a Message is transmitted over by some Operation.
- **Components** holds a set of reusable objects for different aspects of the AsyncAPI specification.
- **Contact** contains Contact information of the Application or Client API.
- **Correlation Id** specifies an identifier at design time that can used for message tracing and correlation.
- **CorrelationId** specifies an identifier at design time that can be used for message tracing and correlation.
- **Info** contains defined information about the Application or Client API.
- **License** contains License information of the Application or Client API.
- **Message** represents a message in your message-driven architecture. They can relate to Operations and Channels, but the relationship is not mandatory.
- **OauthFlow** holds configuration details for a supported OAuth Flow.
- **OauthFlows** allows configuration of the supported OAuth Flows.
- **OAuthFlow** holds configuration details for a supported OAuth Flow.
- **OAuthFlows** allows configuration of the supported OAuth Flows.
- **Operation** describes an action performed by the Application or the Client. It links messages with channels.
- **Schema** is a superset of the [JSON Schema Specification Draft 07](https://json-schema.org/understanding-json-schema/basics.html). See https://www.asyncapi.com/docs/specifications/2.0.0#schemaObject.
- **Schema** is a superset of the [JSON Schema Specification Draft 07](https://json-schema.org/understanding-json-schema/basics.html). See https://www.asyncapi.com/docs/specifications/latest#schemaObject.
- **SecurityScheme** represents security specifications for servers.
- **Server** represents a Server in your message-driven architecture. Application or Client always want to connect to some server.
- **Server** represents a Server in your message-driven architecture. Application or Client always wants to connect to some server.
- **ServerVariable** represents a Server Variable for server URL template substitution.
- **Tag** contains metadata.
- **Tag** contains metadata

## Development
To avoid polluting the API with intents that have no apparent use case or can be replaced by a call to another model, we have defined the following rule:
To avoid polluting the API with intents that have no clear use case or can be replaced by a call to another model, we have defined the following rule:

Intents at the root model (`AsyncAPI`) **SHOULD** never return properties of other models but instead answer questions, return the model itself or a collection of models.
Loading