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

fix: Centralize OpenAPI schema reference resolution #40

Merged
merged 3 commits into from
Jul 22, 2024
Merged

Conversation

vblagoje
Copy link
Member

@vblagoje vblagoje commented Jul 20, 2024

Why:

Centralizes the OpenAPI schema reference resolution -> more simple and maintainable. Spec has references resolved at creation preventing subtle bugs (i.e parameters of an operationId not resolved properly).

What:

  • Introduced jsonref loading and replacement within the OpenAPISpecification class constructor, ensuring all references are resolved upon object instantiation.

How can it be used:

  • Not user facing

How did you test it:

  • Ensured existing unit tests for the converter functions passed with the refactored codebase to verify backward compatibility and correctness.
  • Adjusted test yaml service to include parameter reference

Notes for the reviewer:

  • Pay special attention to how jsonref resolution was migrated to the OpenAPISpecification class constructor where instance variable spec_dict is by default reference resolved
  • Review if the removal of jsonref_import.check() calls in converter functions could have any unintended side effects, although initial tests suggest the refactoring maintains the desired outcomes.

@vblagoje vblagoje requested a review from a team as a code owner July 20, 2024 22:23
@vblagoje vblagoje requested review from silvanocerza and removed request for a team July 20, 2024 22:23
@coveralls
Copy link

coveralls commented Jul 20, 2024

Pull Request Test Coverage Report for Build 10028845050

Details

  • 6 of 7 (85.71%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 90.727%

Changes Missing Coverage Covered Lines Changed/Added Lines %
haystack_experimental/components/tools/openapi/_payload_extraction.py 1 2 50.0%
Totals Coverage Status
Change from base Build 9994763629: -0.02%
Covered Lines: 1722
Relevant Lines: 1898

💛 - Coveralls

@vblagoje vblagoje merged commit 3258230 into main Jul 22, 2024
5 checks passed
@vblagoje vblagoje deleted the replaced_refs branch July 22, 2024 09:43
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.

3 participants