Parisson / TimeSide

scalable audio processing framework and server written in Python
https://timeside.ircam.fr/docs/
GNU Affero General Public License v3.0
369 stars 59 forks source link

[Schema/Docs] createTokenObtainPair should return an object with access and refresh keys #190

Closed gnuletik closed 4 years ago

gnuletik commented 4 years ago

In the schema, the routes handling the JWT tokens seems to have an invalid response schema.

createTokenObtainPair

In the schema, the createTokenObtainPair operation's response is an object with a username key. See: https://sandbox.wasabi.telemeta.org/timeside/api/docs/#operation/createTokenObtainPair

However, it should be an object with a refresh and access key.

See

curl 'https://sandbox.wasabi.telemeta.org/timeside/api/token/' -X POST -H 'Content-Type: application/json' -d '{ "username": "XXX", "password": "XXX" }'
{
   "refresh":"....",
   "access":"...."
}

createTokenRefresh

In the schema, the createTokenRefresh operation's response is an object with a refresh key. See: https://sandbox.wasabi.telemeta.org/timeside/api/docs/#operation/createTokenRefresh

However, it should be an object with a refresh key.

curl -v 'https://sandbox.wasabi.telemeta.org/timeside/api/token/refresh/' -X POST -H 'Content-Type: application/json' -d '{ "refresh": "..." }
{"access":"..."}

createTokenVerify

In the schema, the createTokenVerify operation's response is an object with a token key. See: https://sandbox.wasabi.telemeta.org/timeside/api/docs/#operation/createTokenVerify

However, it should be an empty object.

curl -v 'https://sandbox.wasabi.telemeta.org/timeside/api/token/verify/' -X POST -H 'Content-Type: application/json' -d '{ "token": "..." }
{}

Would it be possible to update the schema ? Thanks :)

Tointoin commented 4 years ago

Well, deeper it gets into schema objects harder it becomes to hardcode it with CustomSchemaGenerator. I will update it but it would be good to pull request DRF or schema generation django-rest-framework-simplejwton this.

Tointoin commented 4 years ago

Should access be a boolean or a string?