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

Add a script to generate swagger definitions out of DB schema #1

Open
tomascohen opened this issue Jan 5, 2017 · 0 comments
Open

Comments

@tomascohen
Copy link
Contributor

No description provided.

tomascohen added a commit to tomascohen/koha-misc4dev that referenced this issue Jan 9, 2017
This patch adds a script that uses DBIC schema definitions to generate
Swagger object defintiions. It generates generic descriptions for the
fields until we make a decision on extending our schema metadata with
those descriptions or even put them in the DB backend using MySQL'1 COMMENT

It makes use of a template to generate its output because I belive we
should keep the columns order for the swagger definition (documentation)
so it became impossible to achieve by using JSON->to_json to output
plain JSON data out of the hashref. Instead of that it uses arrays
internally and use the template to arrange things.

Pretty printing is done by an external tool: jq, which needs to be
installed for running the script. The script will die with a message
if the jq binary is not in the path.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ ../misc4dev/koha_schema_to_swagger.pl --class BorrowerAttribute
=> SUCCESS: The expected swagger definition is printed on the terminal

Signed-off-by: Tomas Cohen Arazi <[email protected]>
joubu pushed a commit that referenced this issue Mar 4, 2019
This patch introduces the koha_schema_to_openapi.pl script.
To use it:

- Install 'jq':
  $ sudo apt install jq
- Have this patch applied to your misc4dev clone
- Run:
  $ kshell
 k$ ../misc4dev/koha_schema_to_openapi.pl --resultset Borrower
=> SUCCESS: A skeletal OpenAPI object definition is printed

Signed-off-by: Tomas Cohen Arazi <[email protected]>
joubu pushed a commit that referenced this issue Mar 4, 2019
Signed-off-by: Tomas Cohen Arazi <[email protected]>
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

1 participant