SwagGen icon indicating copy to clipboard operation
SwagGen copied to clipboard

Add Apple App Store Connect Spec

Open Blackjacx opened this issue 5 years ago • 6 comments
trafficstars

I added and build the Apple App Store Connect spec.

Resolves #248 - App Store Connect Open API Spec Doesn't Compile

Blackjacx avatar Sep 09 '20 13:09 Blackjacx

Thanks @Blackjacx! There were some issues in master and tests weren't running. Could you please rebase off current master

yonaskolb avatar Sep 10 '20 02:09 yonaskolb

Alright, that's done 👍 I built the spec again and now this PR has only half of the changes!?

Blackjacx avatar Sep 10 '20 09:09 Blackjacx

Hey there, did you find the time to look into it? Generating the ASC API would be a massive time saver for me :D Tell me if I can do something.

Blackjacx avatar Sep 16 '20 00:09 Blackjacx

Did it work for you @Blackjacx? Cause I tried to build it and got same errors as without this PR changes (and CI check indicates the same errors)

mikhailmaslo avatar Sep 17 '20 08:09 mikhailmaslo

The happen when I run swift build on the generated files. But actually I have no clue why they happen. Yought one of you can help. It is due to how the swift files are generated I guess. This is the main problem I think (public class Links: APIModel):

self.`self` = `self`

The API model has an attribute called self which is generated as String? but as default value the generator sets

`self` 

which is not a string. Ca I change this behavior via templates?

stherold avatar Sep 17 '20 10:09 stherold

Hmm your update looks good @yonaskolb but did the CI run again? It looks like it reports the same errors. I compiled the new version locally. Now the following JSON produces incorrect value (maybe this is also an error in the spec - I donw understand why they specify one of of the same type):

"AppCategoryResponse" : {
        "type" : "object",
        "title" : "AppCategoryResponse",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/AppCategory"
          },
          "included" : {
            "type" : "array",
            "items" : {
              "oneOf" : [ {
                "$ref" : "#/components/schemas/AppCategory"
              }, {
                "$ref" : "#/components/schemas/AppCategory"
              } ]
            }
          },
          "links" : {
            "$ref" : "#/components/schemas/DocumentLinks"
          }
        },
        "required" : [ "data", "links" ]
      }

The result is then:

public class AppCategoryResponse: APIModel {
    [...]
    public var included: [Included]?

But it should probably be:

public class AppCategoryResponse: APIModel {
    [...]
    public var included: [AppCategory]?

stherold avatar Sep 17 '20 20:09 stherold