Skip to content

feat: Support allOf in OpenAPI properties inside schema #22946#22975

Merged
crazywoola merged 2 commits intolanggenius:mainfrom
mike1936:main
Jul 28, 2025
Merged

feat: Support allOf in OpenAPI properties inside schema #22946#22975
crazywoola merged 2 commits intolanggenius:mainfrom
mike1936:main

Conversation

@mike1936
Copy link
Copy Markdown
Contributor

@mike1936 mike1936 commented Jul 25, 2025

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR

Summary

Currently the OpenAPI parser does not handles allOf keyword in the properties of a OpenAPI schema object, this PR tries to implement it.

Basically the key-value pairs of each obj defined inside allOf is merged into the original property, with some special considerations listed as follows:

  • if the value to be merged is a list, those items are concatenated
  • if the value type is not a list, it got merged only if the original property does not have that key

Fix: #22946

Screenshots

Not available since its a backend-specific change.

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 💪 enhancement New feature or request labels Jul 25, 2025
@crazywoola
Copy link
Copy Markdown
Member

Please link an issue in the description.

@mike1936 mike1936 changed the title feat: Support allOf in OpenAPI properties inside schema feat: Support allOf in OpenAPI properties inside schema #22946 Jul 27, 2025
@mike1936
Copy link
Copy Markdown
Contributor Author

fix #22946

@crazywoola crazywoola requested a review from Copilot July 27, 2025 15:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the allOf keyword in OpenAPI schema properties to properly handle schema composition and inheritance. The implementation merges properties from allOf objects into the parent property definition.

  • Implements allOf keyword handling for properties within OpenAPI schema objects
  • Merges key-value pairs from each allOf object with special handling for lists (concatenation) vs other types (merge if key doesn't exist)
  • Adds test coverage for the new functionality with both direct schemas and $ref references

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
api/core/tools/utils/parser.py Implements allOf property merging logic with reference resolution and type-specific merge strategies
api/tests/unit_tests/core/tools/utils/test_parser.py Adds comprehensive test case covering allOf with references and enum merging scenarios

@crazywoola
Copy link
Copy Markdown
Member

Please see the comments if you have some time.

@crazywoola crazywoola merged commit bd5b938 into langgenius:main Jul 28, 2025
7 checks passed
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support allOf in OpenAPI properties inside schema

3 participants