Skip to content

Conversation

@alexpmule
Copy link

@alexpmule alexpmule commented Dec 19, 2025

Add gRPC API Support

This PR adds support for documenting gRPC APIs in the api-endpoint-documentation component.

Changes:

Component (src/ApiEndpointDocumentationElement.js):

  • Added isGrpcEndpoint reactive property to track gRPC endpoints
  • Hide URL section for gRPC endpoints (no HTTP URLs in gRPC)
  • Display gRPC stream type badges (Unary, Client Streaming, Server Streaming, Bidirectional) instead of HTTP methods
  • Map stream types to HTTP method colors for consistent styling (unary→patch/violet, client_streaming→publish/green, server_streaming→subscribe/blue, bidi_streaming→options/gray)
  • Use AmfHelperMixin methods (_isGrpcService, _getGrpcStreamType, _getGrpcStreamTypeDisplayName) for gRPC detection and data extraction

Demo (demo/index.js):

  • Added temporary workaround to auto-select first gRPC service when loading gRPC models
  • Note: This workaround exists because the current published version of api-navigation (^4.2.7) doesn't support gRPC. Once the updated api-navigation with gRPC support is published (currently blocked by npm-token expiration), this workaround should be removed.

Tests (test/api-endpoint-documentation.test.js):

  • Added comprehensive test suite for gRPC functionality covering endpoint detection, URL hiding, stream type rendering, and color mapping

Screenshots:

Screenshot 2025-12-19 at 11 42 44 AM

- Updated package-lock.json to version 3 and added new dependencies.
- Enhanced ApiEndpointDocumentationElement to detect and handle gRPC endpoints.
- Introduced temporary workarounds for gRPC API auto-selection in demo.
- Added tests for gRPC functionality, ensuring correct operation detection and rendering.
- Updated package.json to reflect the new version of @api-components/amf-helper-mixin.
- Added methods to lookup gRPC services and methods in AmfLoader.
- Updated .gitignore to include gRPC test files.
- Modified test to load gRPC API without compact option.
@alexpmule alexpmule self-assigned this Dec 19, 2025
- Changed the operating system from Ubuntu 20.04 to 22.04.
- Upgraded Node.js version from 14 to 18.
- Updated cache action from v1 to v3.
- Replaced `npm ci` with `npm install` for dependency installation.
- Added step to install Playwright browsers with dependencies.
…rkflow

- Eliminated the step to install Playwright browsers with dependencies in both Linux and Windows job configurations.
- Removed TypeScript type annotations and unnecessary HTML template from the web-test-runner configuration file for improved readability.
- Replaced `npm install` with `npm ci` for consistent dependency installation in the GitHub Actions workflow.
- Updated the test command to use `npx web-test-runner` with coverage and specified browsers.
- Cleaned up formatting in the web-test-runner configuration file for improved readability.
- Updated the test command in the GitHub Actions workflow to use `npm test` for consistency across environments.
- Removed the specific configuration for web-test-runner to streamline the testing process.
… updated test command

- Added a verification step to check for the presence of `web-test-runner` in the installation.
- Updated the test command to run `web-test-runner` directly with specified options for improved testing coverage across multiple browsers.
… dependencies

- Replaced `npm ci` with `npm install --legacy-peer-deps` for dependency installation in both Linux and Windows job configurations.
- Simplified the test command to use `npm test` for improved consistency and ease of use.
…dependency installation

- Changed job name from `test_linux` to `tests` and added Windows support in the matrix.
- Replaced `npm install --legacy-peer-deps` with `npm ci` for consistent dependency installation.
- Added Playwright GitHub Action for enhanced testing capabilities.
- Updated the publishing step to trigger on events other than pull requests.
…anagement

- Replaced `npm ci` with `npm install` for a more flexible dependency installation approach.
- Removed Playwright GitHub Action and caching steps to streamline the workflow.
…erification

- Added Playwright browser installation step to ensure required dependencies are present.
- Introduced a verification step to check for the presence of `web-test-runner` and its installation status.
…ved installation steps

- Added a step to clean the npm cache to ensure a fresh environment.
- Updated the npm install command to use flags for a more efficient installation process.
- Separated Playwright browser installation into its own step for clarity and better management.
…mline installation

- Added a step to configure the npm registry for consistent package management.
- Updated the npm install command to specify the registry, ensuring dependencies are fetched from the correct source.
- Maintained the existing cache cleaning and Playwright browser installation steps for efficiency.
- Upgraded various package dependencies including eslint, typescript, and testing libraries for improved performance and compatibility.
- Introduced @commitlint packages for better commit message management.
- Simplified the deployment workflow by removing unnecessary steps and optimizing npm install commands for both Linux and Windows environments.
- Introduced a new step to install Playwright browsers with dependencies to ensure all required testing tools are available.
- This enhancement improves the testing environment setup for consistent test execution.
- Changed the Playwright installation command to use the local binary path for improved compatibility across environments.
- Ensured the command is compatible with both Linux and Windows shell environments.
… improved installation logging

- Added debugging steps to verify the installed Playwright version and check for the presence of the Playwright executable.
- Improved the Playwright browser installation step with logging for better visibility on installation success or failure, including a check for installed browsers.
- Removed debugging steps for Playwright version checks to streamline the workflow.
- Updated the Playwright browser installation command to use a specific version directly with npx for consistency across environments.
- Changed the Playwright browser installation command to use npx for a specific version, ensuring consistency across environments.
- This update simplifies the installation process and maintains compatibility with existing workflows.
…d improved installation logging

- Added steps to cache Playwright browsers based on the version specified in package.json, improving installation efficiency.
- Included logging during the Playwright browser installation process for better visibility and verification of the installation.
…kflow

- Updated Playwright and Playwright Core dependencies to version 1.40.1 in package.json and package-lock.json for improved features and bug fixes.
- Modified the deployment workflow to install the updated Playwright version, ensuring consistency across environments.
- Enhanced caching strategy for npm and Playwright browsers to optimize installation efficiency.
… Playwright installation

- Replaced npm install with npm ci for faster and more reliable dependency installation.
- Simplified Playwright browser installation command to remove version specification, ensuring the latest version is installed with dependencies.
- Enhanced the overall efficiency of the deployment process.
…hance caching strategy

- Upgraded Node.js setup action to v3 for improved performance and features.
- Enhanced caching strategy for Playwright browsers and npm to optimize installation efficiency.
- Added verification step for npm cache to ensure integrity before installation.
- Upgraded several dependencies including @advanced-rest-client/arc-events, @advanced-rest-client/arc-response, and @api-components/api-authorization to their latest versions for improved features and bug fixes.
- Added new dependencies such as @advanced-rest-client/icons and updated existing ones to ensure compatibility and performance enhancements.
- Adjusted the resolution URLs to point to the official npm registry for consistency.
…ge-lock.json

- Updated Playwright and Playwright Core dependencies to version 1.57.0 for improved features and bug fixes.
- Adjusted deployment workflow to reflect the new Playwright version in caching keys for consistency across environments.
…ipts

- Added a custom HTML template for the test runner to load CodeMirror scripts in the correct order before executing tests.
- This enhancement ensures that the necessary CodeMirror modes and addons are available during testing, improving test reliability.
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.

4 participants