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

empty: Kick CI #555

Closed
wants to merge 1 commit into from
Closed

empty: Kick CI #555

wants to merge 1 commit into from

Conversation

simonjbeaumont
Copy link
Collaborator

Motivation

[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]

Modifications

[Describe the modifications you've made.]

Result

[After your change, what will change.]

Test Plan

[Describe the steps you took, or will take, to qualify the change - such as adjusting tests and manual testing.]

@simonjbeaumont
Copy link
Collaborator Author

OK, some of these tests are failing. Here's one example from the above CI run:

Test Case 'CompatibilityTest.testDiscourse' started at 2024-03-28 07:23:56.460
CompatibilityTest.testDiscourse Warning: Compatility test running in debug mode
CompatibilityTest.testDiscourse Downloading OpenAPI document: https://raw.githubusercontent.com/discourse/discourse_api_docs/fa2391353e9c3eb016ccae30daa34467d2ac2616/openapi.yml
CompatibilityTest.testDiscourse Generating Swift code (document size: 401 KB)
/code/Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift:258: error: CompatibilityTest.testDiscourse : failed - unexpected error openapi.yaml: error: Found neither a JSONType nor a Array<JSONType> in .content['application/json'].schema.properties.score.type for the status code '200' response of the **GET** endpoint under `/posts/{id}.json`. 

JSONType could not be decoded because:
Inconsistency encountered when parsing `[unknown object]`: Cannot initialize JSONType from invalid String value .

Array<JSONType> could not be decoded because:
Expected value to be parsable as Sequence but it was not.. thrown
/code/Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift:258: error: CompatibilityTest.testDiscourse : failed - unexpected error openapi.yaml: error: Found neither a JSONType nor a Array<JSONType> in .content['application/json'].schema.properties.score.type for the status code '200' response of the **GET** endpoint under `/posts/{id}.json`. 

JSONType could not be decoded because:
Inconsistency encountered when parsing `[unknown object]`: Cannot initialize JSONType from invalid String value .

Array<JSONType> could not be decoded because:
Expected value to be parsable as Sequence but it was not.. thrown
/code/Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift:258: error: CompatibilityTest.testDiscourse : failed - unexpected error openapi.yaml: error: Found neither a JSONType nor a Array<JSONType> in .content['application/json'].schema.properties.score.type for the status code '200' response of the **GET** endpoint under `/posts/{id}.json`. 

JSONType could not be decoded because:
Inconsistency encountered when parsing `[unknown object]`: Cannot initialize JSONType from invalid String value .

Array<JSONType> could not be decoded because:
Expected value to be parsable as Sequence but it was not.. thrown
<EXPR>:0: error: CompatibilityTest.testDiscourse : threw error "openapi.yaml: error: Found neither a JSONType nor a Array<JSONType> in .content['application/json'].schema.properties.score.type for the status code '200' response of the **GET** endpoint under `/posts/{id}.json`. 

JSONType could not be decoded because:
Inconsistency encountered when parsing `[unknown object]`: Cannot initialize JSONType from invalid String value .

Array<JSONType> could not be decoded because:
Expected value to be parsable as Sequence but it was not.."
Test Case 'CompatibilityTest.testDiscourse' failed (2.535 seconds)

This is weird because I can run this locally just fine:

Test Case '-[OpenAPIGeneratorReferenceTests.CompatibilityTest testDiscourse]' started.
-[CompatibilityTest testDiscourse] Warning: Compatility test running in debug mode
-[CompatibilityTest testDiscourse] Downloading OpenAPI document: https://raw.githubusercontent.com/discourse/discourse_api_docs/fa2391353e9c3eb016ccae30daa34467d2ac2616/openapi.yml
-[CompatibilityTest testDiscourse] Generating Swift code (document size: 401 KB)
-[CompatibilityTest testDiscourse] Creating Swift package: /var/folders/06/__qdhxzn7ld3_bsvfcfz0kch0000gn/T/swift-openapi-compatibility-test-testDiscourse-5522BF90
-[CompatibilityTest testDiscourse] Building Swift package: ["swift", "build", "--package-path", "/var/folders/06/__qdhxzn7ld3_bsvfcfz0kch0000gn/T/swift-openapi-compatibility-test-testDiscourse-5522BF90", "-Xswiftc", "-Xllvm", "-Xswiftc", "-vectorize-slp=false"]
-[CompatibilityTest testDiscourse] Finished compatibility test
Test Case '-[OpenAPIGeneratorReferenceTests.CompatibilityTest testDiscourse]' passed (55.272 seconds).

@czechboy0
Copy link
Collaborator

This is weird because I can run this locally just fine:

Are you using the same resolved Yams version locally as the CI? I suspect that's where the mismatch might be.

@simonjbeaumont
Copy link
Collaborator Author

This is weird because I can run this locally just fine:

Are you using the same resolved Yams version locally as the CI? I suspect that's where the mismatch might be.

This was my thought exactly. And it made me wonder whether we should be checking in Package.resolved for this project, given its main utility is as leaf executable. Which got me further wondering whether that would be honoured when being consumed as a Swift package plugin.

In the meantime, let me try and work out what versions of the dependencies are running in CI.

@simonjbeaumont
Copy link
Collaborator Author

In the meantime, let me try and work out what versions of the dependencies are running in CI.

+ swift test --filter OpenAPIGeneratorReferenceTests.CompatibilityTest
...
Working copy of https://github.com/apple/swift-openapi-runtime resolved at 1.3.2
Working copy of https://github.com/apple/swift-docc-symbolkit resolved at 1.0.0
Working copy of https://github.com/apple/swift-algorithms resolved at 1.2.0
Working copy of https://github.com/jpsim/Yams resolved at 5.1.0
Working copy of https://github.com/apple/swift-docc-plugin resolved at 1.3.0
Working copy of https://github.com/mattpolzin/OpenAPIKit resolved at 3.1.3
Working copy of https://github.com/apple/swift-numerics.git resolved at 1.0.2
Working copy of https://github.com/apple/swift-argument-parser resolved at 1.3.1
Working copy of https://github.com/apple/swift-http-types resolved at 1.0.3
...

@simonjbeaumont
Copy link
Collaborator Author

I hadn't realised that Package.resolved wasn't checked in. Once I realised that it was not, I am able to reproduce the failure locally after a swift package update.

@simonjbeaumont
Copy link
Collaborator Author

I hadn't realised that Package.resolved wasn't checked in. Once I realised that it was not, I am able to reproduce the failure locally after a swift package update.

And, I can confirm that the following restriction in Package.swift restored working behaviour:

-        .package(url: "https://github.com/jpsim/Yams", "4.0.0"..<"6.0.0"),
+        .package(url: "https://github.com/jpsim/Yams", "4.0.0"..<"5.1.0"),

@simonjbeaumont
Copy link
Collaborator Author

Latest release of Yams, 4 days ago, has the following in the release notes1:

Change how empty strings are decoded into nullable properties.

@czechboy0 I'm just catching up on #553, which appears to cover this exact issue.

Footnotes

  1. https://github.com/jpsim/Yams/releases/tag/5.1.0

@czechboy0
Copy link
Collaborator

Yeah, we'll need to dig into this. Based on Matt's comments, the new behavior seems to be the correct behavior, so it's possible we've been silently skipping/ignoring some other syntax errors in OpenAPI documents that now will emit a warning/error diagnostic.

@czechboy0
Copy link
Collaborator

Superseded by #561

@czechboy0 czechboy0 closed this Apr 3, 2024
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.

2 participants