{"id":20375914,"url":"https://github.com/stcarrez/swagger-ada-todo","last_synced_at":"2025-04-12T07:36:05.270Z","repository":{"id":50646077,"uuid":"119895126","full_name":"stcarrez/swagger-ada-todo","owner":"stcarrez","description":"Simple todo list server with OpenAPI","archived":false,"fork":false,"pushed_at":"2024-09-12T21:22:16.000Z","size":43758,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T02:51:08.201Z","etag":null,"topics":["ada","examples","openapi"],"latest_commit_sha":null,"homepage":"","language":"Ada","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stcarrez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-01T21:20:44.000Z","updated_at":"2025-01-24T06:31:19.000Z","dependencies_parsed_at":"2024-09-13T09:12:28.559Z","dependency_job_id":null,"html_url":"https://github.com/stcarrez/swagger-ada-todo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stcarrez%2Fswagger-ada-todo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stcarrez%2Fswagger-ada-todo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stcarrez%2Fswagger-ada-todo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stcarrez%2Fswagger-ada-todo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stcarrez","download_url":"https://codeload.github.com/stcarrez/swagger-ada-todo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248535405,"owners_count":21120553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ada","examples","openapi"],"created_at":"2024-11-15T01:33:58.918Z","updated_at":"2025-04-12T07:36:05.229Z","avatar_url":"https://github.com/stcarrez.png","language":"Ada","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Todo API - OpenAPI Ada Server\n\n## Overview\n\nThis Ada client and server was generated by the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) project.\nBy using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server,\nyou can easily generate a server stub.\n\n## Building\n\nTo build the server you will need the GNAT Ada compiler as well as\nthe [OpenAPI Ada library](https://github.com/stcarrez/swagger-ada).\n\nWhen the GNAT Ada compiler and OpenAPI Ada libraries are installed,\nrun the following command:\n\n```sh\ngprbuild -p -Ptodos\n```\n\n## Running\n\nAfter the build is successfull, you will get the server binary\nin `bin/todos-server` and you can start it as follows:\n```sh\n./bin/todos-server\n```\n\nThe client example is also available in `bin/todos-client` and you\ncan use it to populate the server with todos, update them, list them.\n\nYou can add a todos with the following command:\n\n```\n./bin/todos-client add 'Explain how to use this example'\n./bin/todos-client add 'Integrate OpenAPI generator 5.0.0'\n./bin/todos-client add 'Update the Swagger UI'\n```\n\nYou can list the todos with the following command:\n\n```\n./bin/todos-client list\n 1   waiting  2020-10-24 07:51:55      -                   Explain how to use this example\n 2   waiting  2020-10-24 07:52:29      -                   Integrate OpenAPI generator 5.0.0\n 3   waiting  2020-10-24 07:53:30      -                   Update the Swagger UI   \n```\nYou can delete a todo by using the `del` command and giving the todo identifier:\n\n```\n./bin/todos-client del 3\n```\n\nYou can close a todo by using the `close` command:\n\n```\n./bin/todos-client close 2\n```\n\nAnd the `list` command will show you that the todo is done:\n\n```\n./bin/todos-client list\n 1   waiting  2020-10-24 07:51:55      -                   Explain how to use this example\n 2   done     2020-10-24 07:52:29      2020-10-24 07:53:53 Integrate OpenAPI generator 5.0.0\n```  \n\n## Swagger UI\n\nThe server is running on `localhost:8080` and it can display the Swagger UI\nwith the list of operations supported by the server.  For this, point your\nbrowser to: http://localhost:8080/v1/ui/index.html\n\nIf the server replies with a `404` error, the Swagger UI is not found in the\ninstallation path, update the `todos.properties` file and change the `swagger.dir`\nvalue:\n\n```\nswagger.dir=web;/usr/share/swagger-ada/web/\n```\n\nyou may have to change `/usr` by the installation path (prefix) you have\nused for the [OpenAPI Ada library](https://github.com/stcarrez/swagger-ada).\nThen, restart the server.\n\n## Structure of the server\n\nThe server consists of several Ada packages that are generated from\nthe OpenAPI specification.\n\nSource file | Package | Description\n------------ | ------------- | -------------\nsrc/todos.ads|Todos|The server root package declaration\nsrc/todos-servers.ads|Todos.Servers|The server declaration and instantiation\nsrc/todos-servers.adb|Todos.Servers|The server implementation (empty stubs)\nsrc/server/todos-skeletons.ads|Todos.Skeletons|The server skeleton declaration\nsrc/server/todos-skeletons.adb|Todos.Skeletons|The server skeleton implementation\nsrc/server/todos-models.ads|Todos.Skeletons|The server model types declaration\nsrc/server/todos-models.adb|Todos.Skeletons|The server model types implementation\nsrc/todos-server.adb|Todos.Server|The server main procedure\n\nFiles generated in **src/server** should not be modified.  The server implementation\nfiles (**src/todos-server.ads** and **src/todos-server.adb**) should\nbe modified to implement the server operations.  You can also customize the server\nmain procedure according to your needs.\n\n## Server model\n\nThe server instance is represented by the **Todos.Servers.Server_Type** Ada type.\nThe REST API will need an instance of it to make the operation call.  Two server model\nexists:\n\n* The instance per request model creates an instance of the server type for each request.\n* The shared instance model shares the same instance across all concurrent REST requests.  This instance is protected using an Ada protected object which holds the server instance.\n\nThe choice of the server model is made at the compilation time by instantiating either\nthe **Todos.Skeletons.Skeleton** package or the **Todos.Skeletons.Shared_Instance**\npackage.  Such instantiation is done in **src/todos-server.ads** and the default\nis to use the **Shared_Instance**.\n\n## Implementing a server operation\n\nAll you have to do is implement the server operation in the **src/todos-servers.adb** file.\nThe package already contains the operation with its parameters and you only have to replace\nthe **null** instruction by real code.\n\n# Documentation\n\n## API Documentation\n\nAll URIs are relative to *https://todo.vacs.fr/v1*\n\nMethod | HTTP request | Description\n------------- | ------------- | -------------\n[**Create_Todo**](TasksApi.md#Create_Todo) | **POST** /todos | Create a todo\n[**Delete_Todo**](TasksApi.md#Delete_Todo) | **DELETE** /todos/{todoId} | Delete the todo\n[**List_Todos**](TasksApi.md#List_Todos) | **GET** /todos | List the available tasks\n[**Update_Todo**](TasksApi.md#Update_Todo) | **PUT** /todos/{todoId} | Update the todo\n\n\n## Models\n - [Todos.Models.Todo_Type](Todo_Type.md)\n\n\n## Authorization\n\n## todoAuth\n\n- **Type**: OAuth\n- **Flow**: password\n- **Authorization URL**: \n- **Scopes**: \n  - **write:todo**: Write a todo\n  - **read:todo**: Read a todo\n\n# Docker\n\nA docker container is available for those who want to try OpenAPI todo without installing\nand building all required packages.  To use the OpenAPI todo docker container you can\nrun the following commands:\n\n```\n   sudo docker pull ciceron/openapi-todo\n   sudo docker run --name openapi-todo -p 8080:8080 ciceron/openapi-todo\n```\n\nTo acces the OpenAPI UI, you can point your browser to http://localhost:8080/v1/ui/index.html\n\nTo run the client, you can start in another terminal the following command:\n\n```\n   sudo docker exec -it openapi-todo /bin/bash\n```\n\nThis will start a shell in the container and you can run the following commands to\nsend REST requests on the running server:\n\n```\n   ./bin/todos-client add 'Explain how to use this example'\n   ./bin/todos-client add 'Integrate OpenAPI generator 5.0.0'\n   ./bin/todos-client add 'Update the Swagger UI'\n   ./bin/todos-client list\n```\n\nTo stop the running application you will use:\n```\n   sudo docker stop openapi-ada\n   sudo docker rm openapi-ada\n```\n\nIf you want to build locally the docker image, you can use:\n\n```\n   sudo docker build -t openapi-ada -f docker/Dockerfile .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstcarrez%2Fswagger-ada-todo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstcarrez%2Fswagger-ada-todo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstcarrez%2Fswagger-ada-todo/lists"}