Skip to content

Add finer-grain reference tests for translation phase #103

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

Merged
merged 14 commits into from
Jul 14, 2023

Conversation

simonjbeaumont
Copy link
Collaborator

@simonjbeaumont simonjbeaumont commented Jul 7, 2023

Motivation

We have a reference test, which we've been making use of to validate end-to-end generation from OpenAPI document matches handwritten Swift files. This started out life as the canonical Petstore example from the OpenAPI specification but has since been augmented in various ways to test out some edge cases. This approach isn't scaling too well as we have an all-or-nothing test.

We also don't have great test coverage over the translation phase of the generator pipeline, which translates between the parsed OpenAPI document to an intermediate representation.

Modifications

Add test harnesses for finer grain reference tests that exercise smaller sections of the translation phase. It should allow us to test a small OpenAPI document renders to equivalent Swift source (stripping comments and reformatting).

Result

Hopefully a more modular and maintainable testing strategy as we try to support more of the OpenAPI specification.

Test Plan

This PR is tests.

@simonjbeaumont simonjbeaumont changed the title Finer grain reference tests Add finer-grain reference tests for translation phase Jul 7, 2023
@simonjbeaumont simonjbeaumont force-pushed the finer-grain-reference-tests branch from f4f5110 to 1ab10fe Compare July 7, 2023 13:22
Copy link
Contributor

@czechboy0 czechboy0 left a comment

Choose a reason for hiding this comment

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

Looks great, just one enhancement idea.

Signed-off-by: Si Beaumont <beaumont@apple.com>
@simonjbeaumont simonjbeaumont marked this pull request as ready for review July 12, 2023 14:55
@simonjbeaumont simonjbeaumont requested a review from czechboy0 July 12, 2023 14:55
Copy link
Contributor

@czechboy0 czechboy0 left a comment

Choose a reason for hiding this comment

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

Just a question about the whitespace, otherwise lgtm!

@simonjbeaumont simonjbeaumont requested a review from czechboy0 July 13, 2023 10:34
Copy link
Contributor

@czechboy0 czechboy0 left a comment

Choose a reason for hiding this comment

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

:shipit:

@simonjbeaumont simonjbeaumont enabled auto-merge (squash) July 14, 2023 13:24
@simonjbeaumont simonjbeaumont force-pushed the finer-grain-reference-tests branch from 9a56558 to 4b18a2b Compare July 14, 2023 13:34
@simonjbeaumont simonjbeaumont merged commit 914560c into apple:main Jul 14, 2023
@simonjbeaumont simonjbeaumont added the semver/none No version bump required. label Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants