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(soap): auto detection of SOAP namespace, and allow to customize it #8414

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented Feb 22, 2025

Auto detection of SOAP version to decide SOAP namespace;
For SOAP 1.1, it is set to http://schemas.xmlsoap.org/soap/envelope/ and for SOAP 1.2, it is set to http://www.w3.org/2003/05/soap-envelope.

If you want to use a custom namespace, you can set it like below;

import { defineConfig } from '@graphql-mesh/compose-cli'
import { loadSOAPSubgraph } from '@omnigraph/soap'

export const composeConfig = defineConfig({
  subgraphs: [
    {
      sourceHandler: loadSOAPSubgraph('CountryInfo', {
        source:
          'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL',
        soapNamespace: 'http://foo.com/schemas/soap/envelope'
      })
    }
  ]
})

Summary by CodeRabbit

  • New Features

    • Enhanced SOAP handling to automatically detect the SOAP version and apply the correct default namespace for both SOAP 1.1 and SOAP 1.2.
    • Introduced configuration options to override the default SOAP namespace and improved logging during SOAP operations.
  • Documentation

    • Updated documentation with a new “Custom SOAP namespace” section, providing clear configuration examples and guidance for custom SOAP setups.

Copy link
Contributor

github-actions bot commented Feb 22, 2025

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

Copy link
Contributor

github-actions bot commented Feb 22, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-mesh/cache-cfw-kv 0.104.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-file 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-inmemory-lru 0.0.15-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-localforage 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-redis 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-upstash-redis 0.0.6-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/compose-cli 1.3.13-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-composition 0.7.25-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/include 0.2.18-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/apollo-link 0.105.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/cli 0.98.26-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/config 0.106.26-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/graphql 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/grpc 0.107.10-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/json-schema 0.108.22-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/mongoose 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/mysql 0.104.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/neo4j 0.105.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/odata 0.105.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/openapi 0.108.23-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/postgraphile 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/raml 0.108.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/soap 0.106.0-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/supergraph 0.9.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/thrift 0.105.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/tuql 0.104.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/http 0.105.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-bare 0.104.22-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-stitching 0.104.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/migrate-config-cli 1.4.18-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/runtime 0.105.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/store 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-cache 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-encapsulate 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-extend 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-federation 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-filter-schema 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hive 0.103.22-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hoist-field 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-naming-convention 0.103.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prefix 0.103.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prune 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rate-limit 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rename 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-replace-field 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-resolvers-composition 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-transfer-schema 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-type-merging 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/types 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/urql-exchange 0.105.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/utils 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/json-schema 0.108.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/mysql 0.8.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/neo4j 0.9.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/odata 0.1.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/openapi 0.108.23-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/raml 0.108.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/soap 0.106.0-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/sqlite 0.7.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@omnigraph/thrift 0.8.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-deduplicate-request 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-hive 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-cache 0.104.7-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-details-extensions 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-jit 0.1.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-jwt-auth 1.4.9-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-live-query 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-mock 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-newrelic 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-field-permissions 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-headers 1.3.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-rate-limit 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-response-cache 0.103.22-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-snapshot 0.103.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-statsd 0.103.20-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-grpc 0.2.9-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-mysql 0.8.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-neo4j 0.8.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-odata 0.1.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-rest 0.8.21-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-soap 0.9.0-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-sqlite 0.8.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-thrift 0.8.19-alpha-20250222124701-053fde512fa0145b42709d8b56de6a8968a0c712 npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Feb 22, 2025

💻 Website Preview

The latest changes are available as preview in: https://3feb7ebb.graphql-mesh.pages.dev

Copy link
Contributor

coderabbitai bot commented Feb 22, 2025

📝 Walkthrough

Walkthrough

This update enhances SOAP handling across the project by introducing automatic detection of the SOAP version to set the appropriate namespace. New configuration options, especially the soapNamespace property, have been added to multiple interfaces and directives in loaders, executors, and legacy configurations. Additionally, tests have been refactored (including renaming imports and skipping a SOAP call test), and documentation has been updated to include sections on custom SOAP namespace configuration and examples. Logging capabilities have also been integrated into executor functions for improved traceability.

Changes

File(s) Change Summary
.changeset/tangy-moons-post.md Introduces functionality for automatic SOAP version detection to set the appropriate SOAP namespace and provides a configuration example using loadSOAPSubgraph.
examples/soap-demo/tests__bak/soap-demo.test.ts.bak Refactors test suite to use async/await. Updates imports and schema/document handling. Skips the SOAP execution test.
packages/loaders/soap/src/{SOAPLoader.ts,index.ts,types.ts,utils.ts} Adds new optional properties (soapNamespace, soap12) and updates the SOAP directive and annotations to support dynamic SOAP namespace configuration.
packages/transports/soap/src/{executor.ts,index.ts} Integrates the soapNamespace property into envelope attributes, adds a logger parameter to executor functions, and updates method signatures for enhanced logging during executor creation.
website/src/pages/{docs/handlers/soap.mdx,v1/source-handlers/soap.mdx,generated-markdown/SoapHandler.generated.md} Introduces documentation sections on custom SOAP namespace. Clarifies default namespaces for SOAP 1.1 and 1.2 and provides configuration examples.
packages/legacy/{handlers/soap/yaml-config.graphql,types/src/config-schema.json,types/src/config.ts} Adds the soapNamespace field/property to the SOAP handler schema and configuration interfaces, detailing default behaviors based on SOAP version.
packages/loaders/soap/test/soap.test.ts Renames the import of fs.promises to fsPromises and marks the SOAP call execution test as skipped.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Loader as SOAPLoader
    participant Config as LoaderOptions / Annotations
    participant Executor
    participant Logger

    Client->>Loader: Invoke SOAP subgraph loading
    Loader->>Config: Check for custom soapNamespace option
    alt SOAP 1.1 detected
        Config-->>Loader: Return "http://schemas.xmlsoap.org/soap/envelope/"
    else SOAP 1.2 detected
        Config-->>Loader: Return "http://www.w3.org/2003/05/soap-envelope"
    end
    Loader->>Executor: Pass SOAP definition with soapNamespace
    Executor->>Logger: Log warning if soapNamespace is missing
    Logger-->>Executor: Confirm default namespace used
Loading

Poem

I’m Bunny, hopping through the code today,
With namespaces sorted in a brand new way.
SOAP 1.1 or 1.2, I know which door to choose,
Configured and logged, there’s no way to lose.
My little paws tap keys with cheerful glee,
Celebrating precise changes—from SOAP to harmony!
🐇💻

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/transports/soap/src/executor.ts

Oops! Something went wrong! :(

ESLint: 9.20.1

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (2)
packages/loaders/soap/src/index.ts (1)

48-59: ⚠️ Potential issue

Pass soapNamespace option to SOAPLoader.

The soapNamespace option is not being propagated to the SOAPLoader constructor.

Apply this diff:

     const soapLoader = new SOAPLoader({
       subgraphName,
       fetch,
       logger,
       cwd,
       // Configuration from the user
       schemaHeaders: options.schemaHeaders,
       operationHeaders: options.operationHeaders,
       endpoint: options.endpoint,
       bodyAlias: options.bodyAlias,
       soapHeaders: options.soapHeaders,
+      soapNamespace: options.soapNamespace,
     });
examples/soap-demo/tests__bak/soap-demo.test.ts.bak (1)

1-41: ⚠️ Potential issue

Remove .bak extension from the test file.

The .bak extension suggests this is a backup file. If this is the active test file, it should be renamed to remove the .bak extension.

Run this command to rename the file:

#!/bin/bash
mv examples/soap-demo/tests__bak/soap-demo.test.ts.bak examples/soap-demo/tests/soap-demo.test.ts
🧹 Nitpick comments (3)
packages/loaders/soap/src/SOAPLoader.ts (1)

409-411: Consider enhancing SOAP version detection.

The current implementation only checks for the presence of soap12 attribute. Consider:

  1. Adding more robust version detection logic
  2. Extracting the version detection logic into a separate method for better maintainability
-    if (definition.attributes.soap12) {
-      this.soapNamespace = 'http://www.w3.org/2003/05/soap-envelope';
-    }
+    private detectSoapVersion(definition: WSDLDefinition): string {
+      // Check for SOAP 1.2 indicators
+      if (
+        definition.attributes.soap12 ||
+        definition.types?.some(type =>
+          type.schema.some(schema =>
+            schema.import?.some(imp =>
+              imp.attributes.namespace === 'http://www.w3.org/2003/05/soap-envelope'
+            )
+          )
+        )
+      ) {
+        return 'http://www.w3.org/2003/05/soap-envelope';
+      }
+      // Default to SOAP 1.1
+      return 'http://schemas.xmlsoap.org/soap/envelope/';
+    }
+
+    // In loadDefinition method
+    this.soapNamespace = this.detectSoapVersion(definition);
website/src/pages/docs/handlers/soap.mdx (2)

87-89: Improve clarity of the documentation.

The sentence structure could be improved for better readability:

-By default, Mesh detects the namespace from the WSDL file. If you want to use a custom namespace
-based on SOAP version.
+By default, Mesh detects the SOAP version from the WSDL file and automatically sets the appropriate namespace.
🧰 Tools
🪛 LanguageTool

[style] ~87-~87: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...he namespace from the WSDL file. If you want to use a custom namespace based on SOAP ve...

(REP_WANT_TO_VB)


90-102: Consider adding more context to the documentation.

The documentation would benefit from:

  1. Example XML output showing the namespace in use
  2. Note about precedence between auto-detection and custom namespace

Add the following content:

For example, with SOAP 1.2, the generated XML will look like:

```xml
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
   <soap:Body>
      <!-- ... -->
   </soap:Body>
</soap:Envelope>

Note: When a custom namespace is specified, it takes precedence over the auto-detected version.


<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 LanguageTool</summary>

[style] ~93-~93: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ....w3.org/2003/05/soap-envelope`.  If you want to use a custom namespace, you can set it ...

(REP_WANT_TO_VB)

</details>

</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 6e68b0da318f2ec3bd761722b5cbda2249f8e4e2 and 6a9788f8d26ce4a03f3c21a78f3e580203cc0640.

</details>

<details>
<summary>⛔ Files ignored due to path filters (4)</summary>

* `e2e/soap-demo/__snapshots__/soap-demo.test.ts.snap` is excluded by `!**/*.snap`
* `packages/loaders/soap/test/__snapshots__/examples.test.ts.snap` is excluded by `!**/*.snap`
* `packages/loaders/soap/test/__snapshots__/soap.test.ts.snap` is excluded by `!**/*.snap`
* `packages/transports/soap/tests/__snapshots__/headers.spec.ts.snap` is excluded by `!**/*.snap`

</details>

<details>
<summary>📒 Files selected for processing (10)</summary>

* `.changeset/tangy-moons-post.md` (1 hunks)
* `examples/soap-demo/tests/soap-demo.test.ts` (0 hunks)
* `examples/soap-demo/tests__bak/soap-demo.test.ts.bak` (1 hunks)
* `packages/loaders/soap/src/SOAPLoader.ts` (6 hunks)
* `packages/loaders/soap/src/index.ts` (1 hunks)
* `packages/loaders/soap/src/types.ts` (1 hunks)
* `packages/loaders/soap/src/utils.ts` (1 hunks)
* `packages/transports/soap/src/executor.ts` (2 hunks)
* `website/src/pages/docs/handlers/soap.mdx` (1 hunks)
* `website/src/pages/v1/source-handlers/soap.mdx` (1 hunks)

</details>

<details>
<summary>💤 Files with no reviewable changes (1)</summary>

* examples/soap-demo/tests/soap-demo.test.ts

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>.changeset/tangy-moons-post.md</summary>

[misspelling] ~5-~5: This word is normally spelled with a hyphen.
Context: ...p': minor '@omnigraph/soap': minor ---  Auto detection of SOAP version to decide SOAP namespac...

(EN_COMPOUNDS_AUTO_DETECTION)

</details>
<details>
<summary>website/src/pages/docs/handlers/soap.mdx</summary>

[style] ~87-~87: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...he namespace from the WSDL file. If you want to use a custom namespace based on SOAP ve...

(REP_WANT_TO_VB)

---

[style] ~93-~93: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ....w3.org/2003/05/soap-envelope`.  If you want to use a custom namespace, you can set it ...

(REP_WANT_TO_VB)

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: e2e / node v22
* GitHub Check: e2e / node v20
* GitHub Check: e2e / node v18

</details>

<details>
<summary>🔇 Additional comments (7)</summary><blockquote>

<details>
<summary>packages/loaders/soap/src/types.ts (1)</summary>

`4-4`: <details>
<summary>❓ Verification inconclusive</summary>

**LGTM! Verify SOAP 1.2 attribute usage.**

The `soap12` attribute is correctly defined as an optional string property in the `WSDLDefinitionAttributes` interface.


Let's verify how this attribute is used in WSDL files:

---

🏁 Script executed:

```shell
#!/bin/bash
# Search for SOAP 1.2 namespace usage in WSDL files
rg -t xml "http://www.w3.org/2003/05/soap-envelope" -A 5

Length of output: 56


LGTM – Proceed with Caution

The addition of the soap12 property in the WSDLDefinitionAttributes interface is correctly implemented and maintains backward compatibility for detecting SOAP versions. However, the automated search for the SOAP 1.2 namespace (http://www.w3.org/2003/05/soap-envelope) did not return any results. Please verify manually whether your WSDL files are expected to reference SOAP 1.2. If such references should exist, ensure that the corresponding WSDL files include the SOAP 1.2 namespace; otherwise, the attribute might not be utilized as anticipated.

packages/loaders/soap/src/index.ts (1)

37-43: LGTM! Clear and informative documentation.

The JSDoc clearly explains the auto-detection behavior and default namespaces for different SOAP versions.

packages/transports/soap/src/executor.ts (1)

92-92: LGTM!

The addition of the soapNamespace property to the SoapAnnotations interface and its usage in the envelope attributes is well-implemented. This change enables dynamic SOAP namespace support based on the SOAP version or custom configuration.

Also applies to: 146-146

packages/loaders/soap/src/SOAPLoader.ts (1)

80-80: LGTM!

The addition of the soapNamespace property to the interfaces and class is well-implemented. This change enables custom SOAP namespace support while maintaining backward compatibility.

Also applies to: 146-148, 203-203, 216-216

.changeset/tangy-moons-post.md (1)

1-28: LGTM!

The changeset is well-documented and includes:

  1. Clear description of the SOAP version auto-detection feature
  2. Default namespace values for each SOAP version
  3. Example configuration for custom namespace
🧰 Tools
🪛 LanguageTool

[misspelling] ~5-~5: This word is normally spelled with a hyphen.
Context: ...p': minor '@omnigraph/soap': minor --- Auto detection of SOAP version to decide SOAP namespac...

(EN_COMPOUNDS_AUTO_DETECTION)

website/src/pages/v1/source-handlers/soap.mdx (2)

122-130: Documentation Enhancement: Custom SOAP Namespace Overview

The new section clearly explains how Mesh auto-detects the SOAP namespace based on the WSDL file details and describes the defaults for SOAP 1.1 and 1.2. This explanation provides useful context before showing the configuration snippet. Consider a quick review of the spacing between lines for consistency with the rest of the document; however, the content is clear and concise.


131-147: Configuration Example Accuracy: Custom SOAP Namespace Setup

The provided TypeScript code snippet succinctly demonstrates how to override the default SOAP namespace by utilizing the soapNamespace property within the loadSOAPSubgraph configuration. The imports and configuration usage are consistent with other examples in the docs, making it easy for users to adapt this setup.

@ardatan ardatan force-pushed the auto-detect-soap-version branch from ed73958 to c4e9853 Compare February 22, 2025 12:31
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
.changeset/tangy-moons-post.md (1)

8-8: Fix hyphenation in the description.

"Auto detection" should be hyphenated as "Auto-detection" for correct compound word formatting.

-Auto detection of SOAP version to decide SOAP namespace;
+Auto-detection of SOAP version to decide SOAP namespace;
website/src/generated-markdown/SoapHandler.generated.md (1)

17-20: Fix list item indentation.

The soapNamespace property documentation should maintain consistent indentation with other properties in the list.

-* `soapNamespace` (type: `String`) - The namespace of the SOAP envelope
-By default, SOAP handler detects the SOAP version and if SOAP version is 1.1,
-it uses `http://schemas.xmlsoap.org/soap/envelope/` namespace
-If SOAP version is 1.2, it uses `http://www.w3.org/2003/05/soap-envelope` namespace
+* `soapNamespace` (type: `String`) - The namespace of the SOAP envelope
+  By default, SOAP handler detects the SOAP version and if SOAP version is 1.1,
+  it uses `http://schemas.xmlsoap.org/soap/envelope/` namespace
+  If SOAP version is 1.2, it uses `http://www.w3.org/2003/05/soap-envelope` namespace
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

17-17: Inconsistent indentation for list items at the same level
Expected: 2; Actual: 0

(MD005, list-indent)

website/src/pages/docs/handlers/soap.mdx (1)

85-102: Custom SOAP Namespace Documentation:

The new "Custom SOAP namespace" section is well integrated into the docs. It clearly explains that the Mesh handler auto-detects the SOAP version and uses the corresponding default namespace while also allowing users to override it via the soapNamespace property. The YAML snippet example is clear and practical.

One minor suggestion: consider varying the phrasing in parts of the description (especially around lines ~87 and ~93) to avoid repetition, as highlighted by static analysis hints. This will improve readability without altering the meaning.

🧰 Tools
🪛 LanguageTool

[style] ~87-~87: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...he namespace from the WSDL file. If you want to use a custom namespace based on SOAP ve...

(REP_WANT_TO_VB)


[style] ~93-~93: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ....w3.org/2003/05/soap-envelope`. If you want to use a custom namespace, you can set it ...

(REP_WANT_TO_VB)

packages/legacy/types/src/config-schema.json (1)

3073-3075: Add Custom SOAP Namespace Property:

The addition of the soapNamespace property in the SoapHandler definition is well executed. The property is defined as a string and its description clearly explains the default behavior—using http://schemas.xmlsoap.org/soap/envelope/ for SOAP 1.1 and http://www.w3.org/2003/05/soap-envelope for SOAP 1.2—while also enabling a custom override.

Minor language adjustments could further improve clarity (for example, consider breaking the description into a couple of shorter sentences), but overall the implementation aligns well with the PR objectives.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a9788f and c4e9853.

⛔ Files ignored due to path filters (4)
  • e2e/soap-demo/__snapshots__/soap-demo.test.ts.snap is excluded by !**/*.snap
  • packages/loaders/soap/test/__snapshots__/examples.test.ts.snap is excluded by !**/*.snap
  • packages/loaders/soap/test/__snapshots__/soap.test.ts.snap is excluded by !**/*.snap
  • packages/transports/soap/tests/__snapshots__/headers.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (15)
  • .changeset/tangy-moons-post.md (1 hunks)
  • examples/soap-demo/tests__bak/soap-demo.test.ts.bak (1 hunks)
  • packages/legacy/handlers/soap/yaml-config.graphql (1 hunks)
  • packages/legacy/types/src/config-schema.json (1 hunks)
  • packages/legacy/types/src/config.ts (1 hunks)
  • packages/loaders/soap/src/SOAPLoader.ts (6 hunks)
  • packages/loaders/soap/src/index.ts (1 hunks)
  • packages/loaders/soap/src/types.ts (1 hunks)
  • packages/loaders/soap/src/utils.ts (1 hunks)
  • packages/loaders/soap/test/soap.test.ts (3 hunks)
  • packages/transports/soap/src/executor.ts (7 hunks)
  • packages/transports/soap/src/index.ts (1 hunks)
  • website/src/generated-markdown/SoapHandler.generated.md (1 hunks)
  • website/src/pages/docs/handlers/soap.mdx (1 hunks)
  • website/src/pages/v1/source-handlers/soap.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/loaders/soap/src/types.ts
  • packages/loaders/soap/src/index.ts
  • packages/loaders/soap/src/utils.ts
  • packages/loaders/soap/src/SOAPLoader.ts
  • website/src/pages/v1/source-handlers/soap.mdx
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
website/src/generated-markdown/SoapHandler.generated.md

17-17: Inconsistent indentation for list items at the same level
Expected: 2; Actual: 0

(MD005, list-indent)

🪛 LanguageTool
.changeset/tangy-moons-post.md

[misspelling] ~7-~7: This word is normally spelled with a hyphen.
Context: ...minor '@graphql-mesh/types': patch --- Auto detection of SOAP version to decide SOAP namespac...

(EN_COMPOUNDS_AUTO_DETECTION)

website/src/pages/docs/handlers/soap.mdx

[style] ~87-~87: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...he namespace from the WSDL file. If you want to use a custom namespace based on SOAP ve...

(REP_WANT_TO_VB)


[style] ~93-~93: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ....w3.org/2003/05/soap-envelope`. If you want to use a custom namespace, you can set it ...

(REP_WANT_TO_VB)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: unit / node 20
  • GitHub Check: e2e / node v22
  • GitHub Check: unit / node 18
  • GitHub Check: e2e / node v20
  • GitHub Check: e2e / node v18
🔇 Additional comments (7)
packages/transports/soap/src/index.ts (1)

7-8: LGTM! Logger integration looks good.

The addition of the logger parameter enhances observability of SOAP operations.

Also applies to: 15-15

examples/soap-demo/tests__bak/soap-demo.test.ts.bak (1)

10-38: Add test cases for SOAP namespace functionality.

The test suite should include specific test cases for:

  • Auto-detection of SOAP version
  • Custom SOAP namespace configuration

Add these test cases:

  it('should give correct response for example queries', async () => {
    for (const source of config.documents) {
      if (!source.document || !source.location) {
        throw new Error(`Invalid document config: ${inspect(source)}`);
      }
      const result = await mesh.execute(source.document);
      expect(result.errors).toBeUndefined();
      expect(result).toMatchSnapshot(basename(source.location) + '-soap-demo-result');
    }
  });
+  it('should detect SOAP version correctly', async () => {
+    const result = await mesh.execute(/* GraphQL */ `
+      query TestSoapVersion {
+        soapVersion
+      }
+    `);
+    expect(result.data?.soapVersion).toMatch(/1\.[12]/);
+  });
+  it('should use custom SOAP namespace when configured', async () => {
+    const customNamespace = 'http://foo.com/schemas/soap/envelope';
+    const result = await mesh.execute(/* GraphQL */ `
+      query TestCustomNamespace($namespace: String!) {
+        soapNamespace(namespace: $namespace)
+      }
+    `, {
+      variables: { namespace: customNamespace }
+    });
+    expect(result.data?.soapNamespace).toBe(customNamespace);
+  });
packages/loaders/soap/test/soap.test.ts (1)

18-18: Clarify why the SOAP call test is skipped.

While the TODO comment mentions "Implement this locally later", it would be helpful to understand:

  1. Why was the test working before and not now?
  2. What specific local implementation is needed?
  3. What E2E tests cover this functionality?
packages/transports/soap/src/executor.ts (1)

310-315: LGTM! Logger integration is well-implemented.

Good practices observed:

  • Default logger prevents null pointer issues
  • Logger parameter is consistently passed through the call chain
packages/legacy/types/src/config.ts (1)

1022-1028: LGTM! Well-documented addition of the soapNamespace property.

The new optional property is properly typed and includes comprehensive JSDoc comments explaining the automatic SOAP version detection behavior and namespace defaults.

.changeset/tangy-moons-post.md (1)

1-6: LGTM! Appropriate version bumps for the feature scope.

The version bumps align well with the scope of changes:

  • Minor bumps for packages with new features
  • Patch bump for types package with non-breaking additions
packages/legacy/handlers/soap/yaml-config.graphql (1)

32-38: LGTM! Well-structured schema addition.

The soapNamespace field is properly defined with comprehensive documentation explaining the automatic version detection behavior and default namespaces.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/transports/soap/src/executor.ts (1)

240-262: Consider adding error logging for better observability.

While the error handling is comprehensive, adding error logging would improve observability and debugging capabilities.

    try {
      const responseJSON = xmlToJSONConverter.parse(responseXML, parseXmlOptions);
      return normalizeResult(responseJSON.Envelope[0].Body[0][soapAnnotations.elementName]);
    } catch (e) {
+     logger.error(`Failed to parse SOAP response: ${e.message}`, {
+       error: e,
+       subgraph: soapAnnotations.subgraph,
+       endpoint: soapAnnotations.endpoint,
+     });
      return createGraphQLError(`Invalid SOAP response: ${e.message}`, {
        extensions: {
          subgraph: soapAnnotations.subgraph,
          request: {
            url: soapAnnotations.endpoint,
            method: 'POST',
            body: requestXML,
          },
          response: {
            status: response.status,
            statusText: response.statusText,
            get headers() {
              return Object.fromEntries(response.headers.entries());
            },
            body: responseXML,
          },
        },
      });
    }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4e9853 and 053fde5.

📒 Files selected for processing (1)
  • packages/transports/soap/src/executor.ts (7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e / node v20
🔇 Additional comments (4)
packages/transports/soap/src/executor.ts (4)

15-16: LGTM! Interface changes align with PR objectives.

The addition of the soapNamespace property to SoapAnnotations and the logger property to CreateRootValueMethodOpts properly supports the new SOAP namespace customization feature.

Also applies to: 89-101, 103-110


147-152: LGTM! Correct implementation of SOAP namespace validation.

The validation logic correctly checks for missing soapNamespace and provides an appropriate fallback to SOAP 1.2 namespace with a warning message.


154-156: LGTM! Proper integration of custom SOAP namespace.

The envelope attributes correctly use the dynamic soapNamespace value, enabling customization of the SOAP version.


310-320: LGTM! Proper integration of logging capabilities.

The executor creation properly integrates logging capabilities with a sensible default, maintaining backward compatibility.

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.

1 participant