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

Manually patch the openapi beyond what is possible from autogeneration #10

Open
ccouzens opened this issue Jan 16, 2021 · 3 comments
Open
Labels
help wanted Extra attention is needed

Comments

@ccouzens
Copy link
Owner

The OpenAPI files are all currently auto-generated.

For example, for version 12.0, we download the HTML documentation, it gets processed and we output OpenAPI documentation.

This is great, as it allows me to support a large API and new versions of it without much ongoing effort. And I trust my laptop not to generate typos or make other human mistakes.

The problem is, it can only ever be as good as the HTML documentation. When the HTML documentation is missing information, my program cannot fill in the blanks.

There are several things the HTML documentation is missing:

If someone has the time and ability, I would like them to make any of the above changes (even if incomplete) to a copy of the OpenAPI definitions in this repository.

I imagine they would be given a name like keycloak/12.0-patched.json.

If possible, please keep the formatting and order the same to make it easier to diff with the original versions.

Thanks in advance!
Chris

@ccouzens ccouzens added the help wanted Extra attention is needed label Jan 16, 2021
ccouzens added a commit that referenced this issue Jan 16, 2021
Try and draw attention to this issue:

#10
ccouzens added a commit that referenced this issue Jan 16, 2021
#9
#10

I hope this encourages other people to continue tweaking it.

A basic diff can be found by running

```bash
diff -Naur keycloak/12.0{,-patched}.json
```

producing

```patch
--- keycloak/12.0.json	2021-01-16 13:22:20.000000000 +0000
+++ keycloak/12.0-patched.json	2021-01-16 13:20:20.000000000 +0000
@@ -2542,8 +2542,7 @@
                 "schema": {
                   "type": "array",
                   "items": {
-                    "type": "object",
-                    "additionalProperties": true
+                    "$ref": "#/components/schemas/ClientRepresentation"
                   }
                 }
               }
@@ -7158,8 +7157,7 @@
                 "schema": {
                   "type": "array",
                   "items": {
-                    "type": "object",
-                    "additionalProperties": true
+                    "$ref": "#/components/schemas/IdentityProviderRepresentation"
                   }
                 }
               }
```

Showing that so far I've only patched the return types of
/{realm}/identity-provider/instances and /{realm}/clients.
@frankhommers
Copy link

Yes I have done this by hand. For a lot. But not for "Response" and "Map".

@frankhommers
Copy link

Just got an idea: but I am not sure if this is usable: Could you make your generator so that it falls back to an older version to get the datatype? That would save a lot of work!

@ccouzens
Copy link
Owner Author

Just got an idea: but I am not sure if this is usable: Could you make your generator so that it falls back to an older version to get the datatype? That would save a lot of work!

I have been thinking of a similiar idea.

When /route/{id} exists, and returns X, then the generator might be able to assume that /route/ returns an array of X.

Unfortunately, I have recently started a volunteer role in addition to my normal job- so I won't have the free time to make the change until maybe the summer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants