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

Version 12 has 'object' as type, but should be array of type. #9

Closed
frankhommers opened this issue Jan 15, 2021 · 5 comments
Closed

Comments

@frankhommers
Copy link

frankhommers commented Jan 15, 2021

I think it's a wider problem than only this, I think if you solve it for this, it will be solved for all:

In v12 this

Get identity providers
GET /{realm}/identity-provider/instances

becomes an object in de openapi json.

But it was in v11 still an array of IdentityProviderRepresentation as it should be.

v12:

"type": "object"

v11:

"type": "array",

@frankhommers frankhommers changed the title Version 12 has object in stead of array Version 12 has object instead of array Jan 15, 2021
@frankhommers frankhommers changed the title Version 12 has object instead of array Version 12 has 'object' as type, but should be array of type. Jan 15, 2021
ccouzens added a commit that referenced this issue Jan 15, 2021
This fixes issue:
#9

Streams are meant to be arrays, so it should have always been this way.
ccouzens added a commit that referenced this issue Jan 15, 2021
This works better in the example app- and so presumably better with
other usecases as well.

#9

I'm now ok with upgrading the examples to version 12.
@ccouzens
Copy link
Owner

Hi @frankhommers ,

Thanks for reporting this 🙂

I've changed it so that Stream in keycloak's documentation produces the following json:

                 "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                 }

I can't make it into an array of IdentityProviderRepresentation because the documentation doesn't have the information in it 🙁

Screenshot_2021-01-15 Keycloak Admin REST API

@ccouzens
Copy link
Owner

ccouzens commented Jan 15, 2021

b865c66...5449ed5

@frankhommers
Copy link
Author

Yeah I see it... In my opinion that's a bug in their documentation. This change to stream made it pretty useless :(

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.
@ccouzens
Copy link
Owner

I've created a patched version of 12.0, so that these fixes can be made manually.

https://github.com/ccouzens/keycloak-openapi/blob/master/keycloak/12.0-patched.json

So far, it just fixes the return type of /{realm}/identity-provider/instances and /{realm}/clients.

I've also made a "help wanted" issue for someone other than me to continue making fixes such as this #10

@frankhommers
Copy link
Author

I did the same but for much more. I opened 12.json, 11.json and 10.json, and merged everything applicable into 12.json. I'll fork.

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

No branches or pull requests

2 participants