Skip to content

feat(ls): add AsyncAPI 3 completion for new keywords#5103

Merged
robert-hebel-sb merged 39 commits intomainfrom
feat/oss-244-complete-for-async-3
Feb 3, 2026
Merged

feat(ls): add AsyncAPI 3 completion for new keywords#5103
robert-hebel-sb merged 39 commits intomainfrom
feat/oss-244-complete-for-async-3

Conversation

@robert-hebel-sb
Copy link
Contributor

@robert-hebel-sb robert-hebel-sb commented Jan 21, 2026

Add AsyncAPI 3.0.0 completion for new keywords

Summary

This PR adds comprehensive completion support for new and updated keywords introduced in AsyncAPI 3.0.0, building on the validation and documentation work from previous PRs.

Changes

Completion Items Added

Root Level

  • operations: New root-level Operations Object for defining application operations

Channel Object

  • address: Runtime expression for channel address (replaces static identifier in v2)
  • title: Human-readable title for the channel
  • summary: Short summary of the channel
  • messages: Map of messages available on the channel (REQUIRED in AsyncAPI 3)
  • tags: List of tags for documentation grouping
  • externalDocs: External documentation reference

Operation Object

  • action: Operation type - send or receive (REQUIRED in AsyncAPI 3)
    • Includes value completions for both options
  • channel: Reference to a Channel Object (REQUIRED in AsyncAPI 3)
  • title: Human-readable title
  • messages: List of message references for this operation
  • reply: Reply Object for request-reply pattern support

Server Object

  • host: Server host (replaces url in v2, REQUIRED in AsyncAPI 3)
  • pathname: URL path component
  • title: Human-readable title
  • summary: Short summary
  • externalDocs: External documentation reference

Info Object

  • tags: Tags list (moved from root in v3)
  • externalDocs: External documentation (moved from root in v3)

Components Object

  • operations: Reusable operation objects
  • replies: Reusable reply objects
  • replyAddresses: Reusable reply address objects
  • tags: Reusable tag objects
  • externalDocs: Reusable external documentation objects

Parameter Object

  • enum: Enumeration of allowed values
  • default: Default value
  • examples: Array of example values

Multi-Format Schema Object

  • Added 14 schema format value completions:
    • AsyncAPI 3.0.0 (default)
    • JSON Schema (Draft 04, 07, 2019-09, 2020-12)
    • OpenAPI Schema (3.0.0, 3.1.0)
    • Avro (1.9.0, 1.10.0, 1.11.1)
    • Protobuf (2, 3)
    • RAML 1.0
    • Each with appropriate sortText for ordering

Messages/Operations Objects

  • $ref: Reference completion for both objects

Bug Fix

  • Fixed OAuth Flows authorizationCode completion where insertText was incorrectly set to clientCredentials

Test Coverage

Added comprehensive test coverage with 18 new tests across 7 test files:

  • test/server.ts - 3 tests for server field completions
  • test/info.ts - 2 tests for info field completions
  • test/components.ts - 4 tests for components field completions
  • test/parameter.ts - 2 tests for parameter field completions
  • test/multi-format-schema.ts - 1 test for schema format values
  • test/channel.ts - 3 additional tests for channel field completions
  • test/operation.ts - 1 additional test for operation action values
  • test/asyncapi-yaml.ts - 1 test for root operations field
  • test/asyncapi-json.ts - 1 test for root operations field

Updated existing test fixtures to include new completion items.

All 254 tests passing.

Testing

npm run test -- test/asyncapi-yaml.ts test/asyncapi-json.ts                                                                                                                                                                                                                          
npm run test -- test/channel.ts test/operation.ts test/server.ts test/info.ts test/components.ts test/parameter.ts test/multi-format-schema.ts                                                                                                                                       
                                                                                                                                                                                                                                                                                     
References                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                     
- AsyncAPI 3.0.0 Specification: https://www.asyncapi.com/docs/reference/specification/v3.0.0                                                                                                                                                                                         
- AsyncAPI 3.0.0 Release Notes: https://www.asyncapi.com/blog/release-notes-3.0.0                                                                                                                                                                                                    
- Related: #5101 (AsyncAPI 3 validation), #5096 (AsyncAPI 3 documentation)                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                     
Checklist                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                     
- Added completion items for all new AsyncAPI 3.0.0 keywords                                                                                                                                                                                                                         
- Added comprehensive test coverage                                                                                                                                                                                                                                                  
- All tests passing                                                                                                                                                                                                                                                                  
- Followed existing code patterns and conventions                                                                                                                                                                                                                                    
- Documentation included in completion items      

ShikhaSaboo and others added 17 commits January 12, 2026 17:19
This commit completes AsyncAPI 3 documentation support by updating:
- asyncapi3/documentation.ts: Added comprehensive AsyncAPI Object documentation
- components/documentation.ts: Added missing operations property
- operation/documentation.ts: Added required channel property
- security-requirement/documentation.ts: Added AsyncAPI 3 variant with role names support
- common/schema/documentation.ts: Extended all JSON Schema keywords to support AsyncAPI 3

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@robert-hebel-sb robert-hebel-sb marked this pull request as draft January 21, 2026 12:35
robert-hebel-sb and others added 9 commits January 22, 2026 10:33
…-compatible-properties' into feat/oss-245-docs-on-hover-for-async3-new-keywords

# Conflicts:
#	packages/apidom-ls/src/config/common/schema/documentation.ts
- Create separate channel config for AsyncAPI 3 (Channel Object vs Channel Item Object)
- Move AsyncAPI 3 rules from channel-item to new channel folder
- Add field description tables to all AsyncAPI 3 object documentation
- Mark required fields explicitly with REQUIRED prefix in documentation
- Add Reference Object notes where specification requires them
- Add runtime expression note to Operation Reply Address
- Remove invalid AsyncAPI 3 Security Requirement Object documentation
- Update AsyncAPI 3 root object description to match specification
- Update lint rules for Channel Object to use Reference Objects for servers

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Move individual field entries before object-level docs in multi-format-schema
- Move individual field entries before object-level docs in operation-reply
- This ensures field-specific hover documentation displays correctly
- Operations documentation already follows correct pattern with patterned fields

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ywords

# Conflicts:
#	packages/apidom-ls/src/config/asyncapi/asyncapi3/documentation.ts
#	packages/apidom-ls/src/config/asyncapi/components/documentation.ts
#	packages/apidom-ls/src/config/asyncapi/operation/documentation.ts
#	packages/apidom-ls/src/config/common/schema/documentation.ts
Addresses review comments from PR #5102:
- Remove duplicate AsyncAPI 3.0 lint rules from channel-item (now in channel)
- Fix channel documentation comment about parameters field
- Correct Multi Format Schema Object schemaFormat property documentation ordering
- Update Multi Format Schema Object table to match property descriptions
- Fix Operations Object patterned field description to match spec

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ywords

# Conflicts:
#	packages/apidom-ls/src/config/asyncapi/channel/completion.ts
#	packages/apidom-ls/src/config/asyncapi/channel/documentation.ts
#	packages/apidom-ls/src/config/asyncapi/channel/lint/bindings--type.ts
#	packages/apidom-ls/src/config/asyncapi/channel/lint/description--type.ts
#	packages/apidom-ls/src/config/asyncapi/channel/lint/index.ts
#	packages/apidom-ls/src/config/asyncapi/channel/lint/parameters--type.ts
…o feat/oss-244-complete-for-async-3

# Conflicts:
#	packages/apidom-ls/src/config/asyncapi/channel/documentation.ts
#	packages/apidom-ls/src/config/asyncapi/channel/meta.ts
@robert-hebel-sb robert-hebel-sb marked this pull request as ready for review January 29, 2026 15:52
Add comprehensive completion support for AsyncAPI 3.0.0 new and updated keywords:
- Root: operations field
- Channel: address, title, summary, messages, tags, externalDocs
- Operation: action (with value completions), channel, title, messages, reply
- Server: host, pathname, title, summary, externalDocs
- Info: tags, externalDocs (moved from root in v3)
- Components: operations, replies, replyAddresses, tags, externalDocs
- Parameter: enum, default, examples
- Multi-format schema: 14 schema format value completions
- Messages/Operations: $ref completions

Also fix oauth-flows completion insertText for authorizationCode.

Add comprehensive test coverage with 18 new tests across 7 test files.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
robert-hebel-sb and others added 2 commits January 30, 2026 16:00
Update completion definitions and tests based on code review:
- Remove Messages/Operations Object $ref completions (maps don't need them)
- Fix Info tags documentation (remove incorrect Reference Object notation)
- Mark schemaFormat and schema as REQUIRED in Multi-Format Schema
- Remove REQUIRED from Channel messages field (it's optional)
- Add missing $ref completions for Tag and External Documentation Objects
- Update operation-reply and operation messages descriptions with full spec text
- Remove duplicate operations tests from asyncapi-json/yaml
- Refactor test pattern to assert complete completion objects

All 252 tests passing.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add missing $ref keyword completions for:
- Operation Reply Object
- Operation Reply Address Object

Both objects can be Reference Objects per AsyncAPI 3.0.0 spec.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
robert-hebel-sb and others added 7 commits February 2, 2026 10:38
Update messages and title/summary tests to assert entire completion
objects instead of just insertText, following the same pattern as
other AsyncAPI 3 completion tests.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive Message Object documentation for AsyncAPI 3.0.0
including fixed fields table, Message Example Object details,
and examples in JSON and YAML formats.

Key differences from AsyncAPI 2:
- headers/payload support Multi Format Schema Object
- externalDocs can be a Reference Object
- traits use new merge mechanism
- removed messageId and schemaFormat fields

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Remove Reference Object from externalDocs field documentation in Info, Tag, Channel, Server, Operation, Operation Trait, Message Trait, and Components Objects
- Add Reference Object notation to External Documentation Object itself (can be referenced as component)
- Aligns documentation with AsyncAPI 3.0.0 specification

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ssage documentation

- Add comprehensive schema formats table showing required (AsyncAPI 3.0.0, JSON Schema Draft 07) and recommended (Avro, OpenAPI, RAML, Protocol Buffers) formats
- Add JSON and YAML examples demonstrating Avro schema usage with Multi Format Schema Object
- Aligns AsyncAPI 3 documentation completeness with AsyncAPI 2 documentation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…Object

- Add formal JSON Schema specification documentation for 'properties' keyword
- Explain validation behavior: validates child instances against corresponding schemas
- Match documentation style used in common/schema for consistency
- Clarify that omitting the keyword behaves as an empty object

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Base automatically changed from feat/oss-245-docs-on-hover-for-async3-new-keywords to main February 3, 2026 09:05
robert-hebel-sb and others added 3 commits February 3, 2026 10:05
# Conflicts:
#	packages/apidom-ls/src/config/asyncapi/messages/meta.ts
#	packages/apidom-ls/src/config/asyncapi/multi-format-schema/completion.ts
#	packages/apidom-ls/src/config/asyncapi/operation-reply-address/completion.ts
#	packages/apidom-ls/src/config/asyncapi/operation-reply/completion.ts
#	packages/apidom-ls/src/config/asyncapi/operations/meta.ts
Fix linting errors in completion and test files to ensure clean builds.

Changes:
- Fix quote style in operation completion documentation (use double quotes)
- Fix prettier formatting in parameter completion (remove extra line break)
- Remove unused imports in asyncapi-json test (CompletionFormat, CompletionType)
- Fix mocha hook violation in multi-format-schema test (move languageService init inside test)
- Fix prettier formatting in parameter test (add line breaks for long strings)

All lint errors resolved (0 errors, 57 warnings remaining).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@robert-hebel-sb robert-hebel-sb merged commit 923283b into main Feb 3, 2026
8 of 9 checks passed
@robert-hebel-sb robert-hebel-sb deleted the feat/oss-244-complete-for-async-3 branch February 3, 2026 09:39
robert-hebel-sb added a commit that referenced this pull request Feb 13, 2026
- Fix critical bug: authorizationCode flow had wrong insertText
  (was 'clientCredentials')
- Add missing deviceAuthorizationUrl field in oauth-flow completion
- Add missing deviceAuthorization flow in oauth-flows completion
- Split 20+ completion items with combined OpenAPI 3.1/3.2 targetSpecs into
  separate version-specific entries with correct documentation URLs:
  * oauth-flows: implicit, password, clientCredentials, authorizationCode
  * path-item: get, put, post, delete, options, head, patch, trace, servers,
    parameters
  * response: headers, content
  * license: identifier, url
- Update 9 tests to use comprehensive property assertions following
  PR #5103 patterns

This ensures completion items for OpenAPI 3.2 have documentation URLs pointing
to 3.2.0 specification instead of incorrectly referencing 3.1.0 when targeting
both versions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AsyncAPI 3.x enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants