wirthual / deutschland-generator-action

Github action for the generation process of generating docs and code for the deutschland package
Apache License 2.0
0 stars 2 forks source link

Download current OpenAPI spec from URL before client generation #10

Closed maximiliancw closed 1 year ago

maximiliancw commented 1 year ago

This should download the current OpenAPI specification from a given URL — what's the best way for testing this? I could run it in a fork of deutschland, but wasn't sure if that's the best way.

tldr: I'm using curl to overwrite the openapi.yaml file (without checking or sanitizing the input URL)

wirthual commented 1 year ago

Hi,

for compatibility reasons we definitely need to keep the current functionality for this action. For a lot of the APIs there is no official openAPI description, so the openapi.yaml lives only in repo. (Unfortunately, this is the case for most of the repos.)

So in this regard, the fact that the dip-bundestag-api has an official description is the exception. Because of this, I would suggest we simply add an action in the dip-bundestag-api repo which downloads the yaml using curl, does a comparison if the file changed, and commits it if it finds changes. This can run as a cron job. This way all the other functionality would stay the same.

What do you think of this approach? We can keep it self contained and have in mind that we might want to include it in this action once more offical descriptions are available.

For local testing you can see if act works for you.

maximiliancw commented 1 year ago

I understand. Your approach seemed quite straightforward, so I tested it: openapi-sync-action

Since I couldn't get act to run properly, I went with the naive approach of calling the action in its own test job while changing the openapi-url parameter. Thus, I had to do a couple of commits to test the behavior. But, it works, as far as I can tell.

If you could test and verify this, I'd close this PR and create a new one using the new action.

wirthual commented 1 year ago

Looks great!

I am going to include this action into dip-bundestag-api repo using a cron job.

maximiliancw commented 1 year ago

Awesome, thank you!

I'll close this PR then and — if I got that right — you will push the changes including the action in dip-bundestag-api. Otherwise, just let me know and I'll be happy to send another PR.