Skip to content

feat: AsyncAPI#67

Open
makeev-pavel wants to merge 31 commits intofeature/asyncapi-basic-e2efrom
feature/asyncapi-basic-e2e-432
Open

feat: AsyncAPI#67
makeev-pavel wants to merge 31 commits intofeature/asyncapi-basic-e2efrom
feature/asyncapi-basic-e2e-432

Conversation

@makeev-pavel
Copy link
Collaborator

No description provided.


if (!action || !channelRef) {
const { action, channel: operationChannel } = operationObject
if (!action || !operationChannel) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about messages? we consider message-driven operations, don't we?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes - out of scope. This code will either stay to rewrite it or it will go away altogether.

apiType: ASYNCAPI_API_TYPE,
apiKind: calculateAsyncApiKind(operationApiKind, channelApiKind),
deprecated: !!message[ASYNCAPI_DEPRECATION_EXTENSION_KEY],
title: message.title || messageId,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+ message.name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design

APIHUB Operation title(message.title). If the message has no title, the system shall display the messageId.

const protocol = extractProtocol(channel)
// todo Get channelId and messageId. A new api-unifier is awaiting
const channelId = 'channelId'
const messageId = 'messageId'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// If there are not enough operations, we will get an incorrect result.
for (const key of operationKeys) {
if (!refsOnlyOperations[key]) {
return resultSpec
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we exit, not just skip?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is not enough data in refsOnlyOperations, then we will get an uncorrected document


for (const message of messages) {
if (!isObject(message)) {
continue
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is redundant

}

function isServerObject(server: AsyncAPIV3.ServerObject | AsyncAPIV3.ReferenceObject): server is AsyncAPIV3.ServerObject {
return isObject(server) && 'protocol' in server
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isObject + !('$ref' in server')

}

function isTagObject(item: AsyncAPIV3.TagObject | AsyncAPIV3.ReferenceObject): item is AsyncAPIV3.TagObject {
return (item as AsyncAPIV3.TagObject).name !== undefined
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same approach

}

function isExternalDocumentationObject(item: AsyncAPIV3.ExternalDocumentationObject | AsyncAPIV3.ReferenceObject): item is AsyncAPIV3.ExternalDocumentationObject {
return (item as AsyncAPIV3.ExternalDocumentationObject).url !== undefined
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, possibly it's better to make function isReferenceObject and just use it here


return normalize(item, {
source: data,
}) as AsyncAPIV3.TagObject
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be already normalized at this moment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of scope

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll answer it. No, this is before the normalization stage, when preparing the document.

? externalDocs
: normalize(externalDocs, {
source: data,
}) as AsyncAPIV3.ExternalDocumentationObject
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be already normalized at this moment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants