Skip to content

Conversation

@glowcloud
Copy link
Contributor

@glowcloud glowcloud commented Oct 30, 2025

Add tests and fixes related to them.

TODO:

  • overall refractor tests
  • elements tests
  • perf tests
  • replace empty element plugin tests
    • tests
    • snapshots
  • predicates tests
    • copy tests from AsyncAPI 2
    • isMultiFormatSchemaElement tests
    • missing tests for predicates
  • verify some elements/visitors (e.g. MultiFormatSchema) => verified and adjusted based on snapshots


return FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement);
}
const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handling of Multi Format Schema based on MessageVisitor from AsyncAPI 2 namespace.

* @public
*/
export interface MultiFormatSchemaLikeElement extends ObjectElement {
hasKey: (value: 'schemaFormat') => true;
Copy link
Contributor Author

@glowcloud glowcloud Oct 31, 2025

Choose a reason for hiding this comment

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

Question: should we be checking for both schemaFormat and schema presence or is schemaFormat enough? This is for cases where we can have ReferenceElement, SchemaElement or MultiFormatSchemaElement. Currently recognising each element:

  • ReferenceElement - recognised when $ref is present, e.g.:
$ref: <value>


$ref: <value>
prop: <value>

$ref: <value>
schemaFormat: <value>
  • MultiFormatSchemaElement - recognised when schemaFormat is present, e.g.:
schemaFormat: <value>

schemaFormat: <value>
schema: <value>

schemaFormat: <value>
prop: <value>
  • SchemaElement - defaulted to if element was not recognised as ReferenceElement or MultiFormatSchemaElement, e.g.:
prop: <value>

schema: <value>

fixedFields: {
action: { $ref: '#/visitors/value' },
channel: { $ref: '#/visitors/value' },
channel: OperationChannelVisitor,
Copy link
Contributor Author

@glowcloud glowcloud Oct 31, 2025

Choose a reason for hiding this comment

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

Operation.channel is a ReferenceElement but I added a separate visitor for it, so that we can decorate it with metadata (referenced-element: channel). Not sure if we can do it in another way, if we want to have separate visitors for Operation.channel and OperationReply.channel, and if we want the metadata for them to be different, as currently they both use this visitor.

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