Conversation
|
Thank you @iT0ny, which of the changes were required when bumping the OpenAPIKit version, and which ones were nice to have? |
All of them are required, tests mentioned in the PR message were failing. + there was an issue with nil checks after the version bump |
1c0603e to
a2407d9
Compare
|
updated user.email to correctly point to my GitHub email address |
|
Heads up that because of a change that merged into main between when this PR was opened and now, you'll need to require OpenAPIKit v4.3.1 or greater once you've rebased on latest main. |
…emaWarningsForwardedToGeneratorDiagnostics`
04d9eea to
0aa0187
Compare
|
Thanks, done! @mattpolzin |
|
@czechboy0 more of a procedural question: what is your versioning strategy around bumping OpenAPIKit major versions? Some potential considerations:
|
|
TBD, but it's possible we'll do a leap from 3 to 5 directly, as even moving to 4 would require a bit more qualification on my end that I don't have time for right now. |
|
@czechboy0 I nerd sniped myself into this same path, closing the draft PR I created when I realized this was already here. I just tacked on the "semver/patch" label to the PR, but I wasn't sure how we were tracking versions for this when it generates code. |
|
OpenAPIKit v5 is out. https://github.com/mattpolzin/OpenAPIKit/releases/tag/5.0.0. I wasn't rushing to make v4 migration defunct, of course, but since the preference was to move to v5 prior to releasing a new swift-openapi-generator version, here it is! |
|
@iT0ny here's a patch that fixes the "Compatibility test" CI suite. It's just a few more of the "Inconsistency" -> "Problem" verbiage changes. Just in case you've never applied a patch before, you can copy this (including the newline at the end) and then paste it into a file or pipe it into git patchdiff --git a/Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift b/Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift
index b99a4c8..62cd19a 100644
--- a/Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift
+++ b/Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift
@@ -88,7 +88,7 @@ final class CompatibilityTest: XCTestCase {
"https://raw.githubusercontent.com/discourse/discourse_api_docs/8182f1b21ca62cc9ac85fd3a82cae8304033a672/openapi.yml",
license: .apache,
expectedDiagnostics: [
- "Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found nothing but unsupported attributes..",
+ "Validation warning: Problem encountered when parsing `OpenAPI Schema`: Found nothing but unsupported attributes..",
"Multipart request bodies must always be required, but found an optional one - skipping. Mark as `required: true` to get this body generated.",
],
skipBuild: compatibilityTestSkipBuild
@@ -100,15 +100,15 @@ final class CompatibilityTest: XCTestCase {
"https://raw.githubusercontent.com/github/rest-api-description/322663c9c909974af16363b4dc0873c428bdbe34/descriptions-next/api.github.com/api.github.com.yaml",
license: .mit,
expectedDiagnostics: [
- "Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: array. Specifically, attributes for these other types: [\"object\"].",
- "Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"object\"].",
- "Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found nothing but unsupported attributes..",
- "Schema warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
- "Validation warning: Inconsistency encountered when parsing `Schema`: A schema contains properties for multiple types of schemas, namely: [\"array\", \"object\"]..",
- "Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
+ "Validation warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: array. Specifically, attributes for these other types: [\"object\"].",
+ "Validation warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"object\"].",
+ "Validation warning: Problem encountered when parsing `OpenAPI Schema`: Found nothing but unsupported attributes..",
+ "Schema warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
+ "Validation warning: Problem encountered when parsing `Schema`: A schema contains properties for multiple types of schemas, namely: [\"array\", \"object\"]..",
+ "Validation warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
"A property name only appears in the required list, but not in the properties map - this is likely a typo; skipping this property.",
- "Schema warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: array. Specifically, attributes for these other types: [\"object\"].",
- "Schema warning: Inconsistency encountered when parsing `Schema`: A schema contains properties for multiple types of schemas, namely: [\"array\", \"object\"]..",
+ "Schema warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: array. Specifically, attributes for these other types: [\"object\"].",
+ "Schema warning: Problem encountered when parsing `Schema`: A schema contains properties for multiple types of schemas, namely: [\"array\", \"object\"]..",
"Schema \"null\" is not supported, reason: \"schema type\", skipping",
],
skipBuild: true
@@ -121,11 +121,11 @@ final class CompatibilityTest: XCTestCase {
license: .mit,
expectedDiagnostics: [
"Multipart request bodies must always be required, but found an optional one - skipping. Mark as `required: true` to get this body generated.",
- "Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found nothing but unsupported attributes..",
- "Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
+ "Validation warning: Problem encountered when parsing `OpenAPI Schema`: Found nothing but unsupported attributes..",
+ "Validation warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
"A property name only appears in the required list, but not in the properties map - this is likely a typo; skipping this property.",
- "Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"object\"].",
- "Schema warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
+ "Validation warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"object\"].",
+ "Schema warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
"Schema \"null\" is not supported, reason: \"schema type\", skipping",
],
skipBuild: true
|
|
@iT0ny to add a bit of context for what's going on around this PR and the one I am preparing now: Honza and Si have agreed to merge both migration to OpenAPIKit v4 and OpenAPIKit v5 at the same time. I have based migration to v5 off of this branch. If we can get CI green on this branch then we should be in good shape to request code review on both your branch and mine and get that ball rolling again. |
|
@mattpolzin hey, thanks for letting me know, I'll try to update the PR ASAP |
Context
Duplicate of #830. This PR implements the additional changes/fixes for issues surfaced in the original PR
Summary
Details
testEmitsComplexOpenAPIParsingErrorandtestSchemaWarningsForwardedToGeneratorDiagnostics(Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift,Tests/OpenAPIGeneratorCoreTests/Translator/TypesTranslator/Test_translateSchemas.swift)Sources/_OpenAPIGeneratorCore/Translator/CommonTranslations/translateRawEnum.swiftTests/OpenAPIGeneratorCoreTests/Translator/TypeAssignment/Test_TypeMatcher.swiftTesting
swift testFixes #821