Skip to content

Commit

Permalink
[FIX] try fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
boot-sandre committed Oct 6, 2023
1 parent b5e2050 commit 30c4b08
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 140 deletions.
2 changes: 1 addition & 1 deletion docsite/public/doc/account_app/endpoints/docstrings.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"register_save":{"funcdef":"def register_save(\n\trequest: HttpRequest,\n\tdata: RegisterFormContract\n)","description":"Register a user from a registration form","long_description":"Endpoint url: /api/account/register","example":{"code":"# example of valid payload\n{\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"password1\": \"xxxzzzxxx\",\n \"password2\": \"xxxzzzxxx\",\n}\n\n# example of form error payload return with a 422 status code\n{\n \"errors\": {\n 'password2': [\n {\n 'message': 'The two password fields didn’t match.',\n 'code': 'password_mismatch'\n }\n ]\n }\n}","is_executable":false,"description":""},"params":{"request":{"description":"the django http request object","type":"<a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\">HttpRequest</a></a></a></a></a></a>","default":null},"data":{"description":"the form json payload","type":"<a href=\"javascript:openLink('/account_app/schemas/RegisterFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/RegisterFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/RegisterFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/RegisterFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/RegisterFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/RegisterFormContract')\">RegisterFormContract</a></a></a></a></a></a>","default":null}},"raises":[],"returns":{"name":null,"type":"<a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httpresponse-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httpresponse-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httpresponse-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httpresponse-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httpresponse-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httpresponse-objects')\">HttpResponse</a></a></a></a></a></a>"}},"activate_save":{"funcdef":"def activate_save(\n\trequest: HttpRequest,\n\ttoken: str\n) -> Tuple[int, None | MsgResponseContract]","description":"Activate a user from a token","long_description":"Endpoint url: /api/account/activate/{token}<br /><br />User has clicked on link in an email with an activation token, and we activate the user if the token is valid","example":{"code":"# example of an activation refused with a 401 http status code\n{\n \"message\": \"Account activation refused\"\n}","is_executable":false,"description":""},"params":{"request":{"description":"the django http request object","type":"<a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\">HttpRequest</a></a></a></a></a></a>","default":null},"token":{"description":"the token","type":"str","default":null}},"raises":[],"returns":{"name":null,"type":"Tuple[int, None | <a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\">MsgResponseContract</a></a></a></a></a></a>]"}},"authlogin":{"funcdef":"def authlogin(\n\trequest: HttpRequest,\n\tdata: LoginFormContract\n) -> Tuple[int, None | FormInvalidResponseContract | MsgResponseContract]","description":"Login a user from a username and password payload","long_description":"Endpoint url: /api/account/login","example":null,"params":{"request":{"description":"the django http request object","type":"<a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\">HttpRequest</a></a></a></a></a></a>","default":null},"data":{"description":"the username and password payload","type":"<a href=\"javascript:openLink('/account_app/schemas/LoginFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/LoginFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/LoginFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/LoginFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/LoginFormContract')\"><a href=\"javascript:openLink('/account_app/schemas/LoginFormContract')\">LoginFormContract</a></a></a></a></a></a>","default":null}},"raises":[],"returns":{"name":null,"type":"Tuple[int, None | <a href=\"javascript:openLink('/base_app/schemas/FormInvalidResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/FormInvalidResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/FormInvalidResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/FormInvalidResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/FormInvalidResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/FormInvalidResponseContract')\">FormInvalidResponseContract</a></a></a></a></a></a> | <a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\"><a href=\"javascript:openLink('/base_app/schemas/MsgResponseContract')\">MsgResponseContract</a></a></a></a></a></a>]"}},"authlogout":{"funcdef":"def authlogout(\n\trequest: HttpRequest\n) -> Tuple[int, None]","description":"Logout a user","long_description":"Endpoint url: /api/account/logout","example":null,"params":{"request":{"description":"the django http request object","type":"<a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\">HttpRequest</a></a></a></a></a></a>","default":null}},"raises":[],"returns":{"name":null,"type":"Tuple[int, None]"}},"global_state":{"funcdef":"def global_state(\n\trequest: HttpRequest\n) -> Tuple[int, StateContract]","description":"Returns info on user state and set a csrf token","long_description":"Endpoint url: /api/account/state","example":null,"params":{"request":{"description":"the django http request object","type":"<a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\"><a href=\"javascript:openLink('https://docs.djangoproject.com/en/4.1/ref/request-response/#httprequest-objects')\">HttpRequest</a></a></a></a></a></a>","default":null}},"raises":[],"returns":{"name":null,"type":"Tuple[int, <a href=\"javascript:openLink('/account_app/schemas/StateContract')\"><a href=\"javascript:openLink('/account_app/schemas/StateContract')\"><a href=\"javascript:openLink('/account_app/schemas/StateContract')\"><a href=\"javascript:openLink('/account_app/schemas/StateContract')\"><a href=\"javascript:openLink('/account_app/schemas/StateContract')\"><a href=\"javascript:openLink('/account_app/schemas/StateContract')\">StateContract</a></a></a></a></a></a>]"}}}
{"register_save": {"lang": "python", "funcdef": "def register_save(\n\trequest: HttpRequest,\n\tdata: RegisterFormContract\n)", "description": "Register a user from a registration form", "long_description": "Endpoint url: /api/account/register", "example": {"code": "# example of valid payload\n{\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"password1\": \"xxxzzzxxx\",\n \"password2\": \"xxxzzzxxx\",\n}\n\n# example of form error payload return with a 422 status code\n{\n \"errors\": {\n 'password2': [\n {\n 'message': 'The two password fields didn\u2019t match.',\n 'code': 'password_mismatch'\n }\n ]\n }\n}", "is_executable": false, "description": ""}, "params": {"request": {"description": "the django http request object", "type": "HttpRequest", "default": null}, "data": {"description": "the form json payload", "type": "RegisterFormContract", "default": null}}, "raises": [], "returns": {"description": "an http response", "type": "HttpResponse"}}, "activate_save": {"lang": "python", "funcdef": "def activate_save(\n\trequest: HttpRequest,\n\ttoken: str\n) -> Tuple[int, None | SkiiMsgContract]", "description": "Activate a user from a token", "long_description": "Endpoint url: /api/account/activate/{token}<br /><br />User has clicked on link in an email with an activation token, and we activate the user if the token is valid", "example": {"code": "# example of an activation refused with a 401 http status code\n{\n \"message\": \"Account activation refused\"\n}", "is_executable": false, "description": ""}, "params": {"request": {"description": "the django http request object", "type": "HttpRequest", "default": null}, "token": {"description": "the token", "type": "str", "default": null}}, "raises": [], "returns": {"description": "a 204 empty or a 401 with a message if the token is invalid", "type": "Tuple[int, None | MsgResponseContract]"}}, "authlogin": {"lang": "python", "funcdef": "def authlogin(\n\trequest: HttpRequest,\n\tdata: LoginFormContract\n) -> Tuple[int, None | FormInvalidResponseContract | SkiiMsgContract]", "description": "Login a user from a username and password payload", "long_description": "Endpoint url: /api/account/login", "example": null, "params": {"request": {"description": "the django http request object", "type": "HttpRequest", "default": null}, "data": {"description": "the username and password payload", "type": "LoginFormContract", "default": null}}, "raises": [], "returns": {"description": "the http status code and the data payload", "type": "Tuple[int, None | FormInvalidResponseContract | MsgResponseContract]"}}, "authlogout": {"lang": "python", "funcdef": "def authlogout(\n\trequest: HttpRequest\n) -> Tuple[int, None]", "description": "Logout a user", "long_description": "Endpoint url: /api/account/logout", "example": null, "params": {"request": {"description": "the django http request object", "type": "HttpRequest", "default": null}}, "raises": [], "returns": {"description": "the http status code and None", "type": "Tuple[int, None]"}}, "global_state": {"lang": "python", "funcdef": "def global_state(\n\trequest: HttpRequest\n) -> Tuple[int, StateContract]", "description": "Returns info on user state and set a csrf token", "long_description": "Endpoint url: /api/account/state", "example": null, "params": {"request": {"description": "the django http request object", "type": "HttpRequest", "default": null}}, "raises": [], "returns": {"description": "the http status code and the data payload", "type": "Tuple[int, StateContract]"}}}
86 changes: 1 addition & 85 deletions docsite/public/doc/account_app/schemas/docstrings.json
Original file line number Diff line number Diff line change
@@ -1,85 +1 @@
{
"LoginFormContract": {
"funcdef": "class LoginFormContract(Schema)",
"description": "Incoming data from login form post",
"long_description": null,
"example": {
"code": "{\n \"username\": \"lamdajoe\",\n \"password\": \"xxx48dioEjni\",\n}",
"is_executable": false,
"description": ""
},
"params": {
"username": {
"description": "the username",
"type": "str | None",
"default": null
},
"password": {
"description": "the password",
"type": "str | None",
"default": null
}
},
"raises": [],
"returns": null
},
"RegisterFormContract": {
"funcdef": "class RegisterFormContract(Schema)",
"description": "Incoming data from registration form post",
"long_description": null,
"example": {
"code": "{\n \"name\": \"lamdajoe\",\n \"email\": \"[email protected]\",\n \"password1\": \"xxx48dioEjni\",\n \"password2\": \"xxx48dioEjni\",\n}",
"is_executable": false,
"description": ""
},
"params": {
"name": {
"description": "the user full name",
"type": "str | None",
"default": null
},
"email": {
"description": "the password",
"type": "str | None",
"default": null
},
"password1": {
"description": "the password confirmation",
"type": "str | None",
"default": null
}
},
"raises": [],
"returns": null
},
"StateContract": {
"funcdef": "class StateContract(Schema)",
"description": "Account state data",
"long_description": "This is returned by the /api/state endpoint called<br />when the frontend app mounts to get the state of the<br />user",
"example": {
"code": "{\n \"is_connected\": True,\n \"username\": \"johndoe\",\n}",
"is_executable": false,
"description": ""
},
"params": {
"is_connected": {
"description": "if the user is connected or not",
"type": "bool",
"default": null
},
"username": {
"description": "the user username",
"type": "str",
"default": null
}
},
"raises": [],
"returns": null,
"extra_examples": [
{
"code": "from apps.account.schemas import StateContract\n\n# inspect the contract\nprops = StateContract.schema()[\"properties\"]\nfor key in props:\n print(key, \"prop is of type\", props[key][\"type\"])\n\n# create a contract\nuser_state_data = {\n \"is_connected\": True,\n \"username\": \"johndoe\",\n}\nstate_contract = StateContract(**user_state_data)\nprint(\"The contract json payload:\", str(state_contract.json(indent=2)))\n",
"is_executable": true
}
]
}
}
{"LoginFormContract": {"lang": "python", "funcdef": "class LoginFormContract(Schema)", "description": "Incoming data from login form post", "long_description": null, "example": {"code": "{\n \"username\": \"lamdajoe\",\n \"password\": \"xxx48dioEjni\",\n}", "is_executable": false, "description": ""}, "params": {"username": {"description": "the username", "type": "str | None", "default": null}, "password": {"description": "the password", "type": "str | None", "default": null}}, "raises": [], "returns": null}, "RegisterFormContract": {"lang": "python", "funcdef": "class RegisterFormContract(Schema)", "description": "Incoming data from registration form post", "long_description": null, "example": {"code": "{\n \"name\": \"lamdajoe\",\n \"email\": \"[email protected]\",\n \"password1\": \"xxx48dioEjni\",\n \"password2\": \"xxx48dioEjni\",\n}", "is_executable": false, "description": ""}, "params": {"name": {"description": "the user full name", "type": "str | None", "default": null}, "email": {"description": "the password", "type": "str | None", "default": null}, "password1": {"description": "the password confirmation", "type": "str | None", "default": null}}, "raises": [], "returns": null}, "StateContract": {"lang": "python", "funcdef": "class StateContract(Schema)", "description": "Account state data", "long_description": "This is returned by the /api/state endpoint called\nwhen the frontend app mounts to get the state of the\nuser", "example": {"code": "{\n \"is_connected\": True,\n \"username\": \"johndoe\",\n}", "is_executable": false, "description": ""}, "params": {"is_connected": {"description": "if the user is connected or not", "type": "bool", "default": null}, "username": {"description": "the user username", "type": "str", "default": null}}, "raises": [], "returns": null}}
Loading

0 comments on commit 30c4b08

Please sign in to comment.