From 71076a6c21533186481a76f021e4438f138391e4 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 24 Nov 2022 23:20:43 +0100 Subject: [PATCH] working openapi-generator --- crates/gitea_raw_client/Cargo.toml | 8 + .../scripts/generate_client.Dockerfile | 5 + .../generate_client.docker-compose.yml | 25 ++ .../scripts/generate_client.dockerignore | 2 + .../scripts/generate_client.entrypoint.sh | 15 + .../scripts/generate_client.sh | 7 + crates/gitea_raw_client/src/.gitignore | 3 + .../src/.openapi-generator-ignore | 23 ++ .../src/.openapi-generator/FILES | 336 ++++++++++++++++++ .../src/.openapi-generator/VERSION | 1 + crates/gitea_raw_client/src/.travis.yml | 1 + 11 files changed, 426 insertions(+) create mode 100644 crates/gitea_raw_client/Cargo.toml create mode 100644 crates/gitea_raw_client/scripts/generate_client.Dockerfile create mode 100644 crates/gitea_raw_client/scripts/generate_client.docker-compose.yml create mode 100644 crates/gitea_raw_client/scripts/generate_client.dockerignore create mode 100755 crates/gitea_raw_client/scripts/generate_client.entrypoint.sh create mode 100755 crates/gitea_raw_client/scripts/generate_client.sh create mode 100644 crates/gitea_raw_client/src/.gitignore create mode 100644 crates/gitea_raw_client/src/.openapi-generator-ignore create mode 100644 crates/gitea_raw_client/src/.openapi-generator/FILES create mode 100644 crates/gitea_raw_client/src/.openapi-generator/VERSION create mode 100644 crates/gitea_raw_client/src/.travis.yml diff --git a/crates/gitea_raw_client/Cargo.toml b/crates/gitea_raw_client/Cargo.toml new file mode 100644 index 0000000..a6e37b4 --- /dev/null +++ b/crates/gitea_raw_client/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "gitea_raw_client" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/gitea_raw_client/scripts/generate_client.Dockerfile b/crates/gitea_raw_client/scripts/generate_client.Dockerfile new file mode 100644 index 0000000..fae7cf7 --- /dev/null +++ b/crates/gitea_raw_client/scripts/generate_client.Dockerfile @@ -0,0 +1,5 @@ +FROM openapitools/openapi-generator-cli + +WORKDIR /src/app + +COPY scripts/generate_client.entrypoint.sh . diff --git a/crates/gitea_raw_client/scripts/generate_client.docker-compose.yml b/crates/gitea_raw_client/scripts/generate_client.docker-compose.yml new file mode 100644 index 0000000..f3f9684 --- /dev/null +++ b/crates/gitea_raw_client/scripts/generate_client.docker-compose.yml @@ -0,0 +1,25 @@ +version: "3" + +services: + gitea: + image: "gitea/gitea:1.17.3" + environment: + ROOT_URL: "http://gitea:3000" + INSTALL_LOCK: "true" + healthcheck: + test: curl --fail http://localhost:3000 || exit 1 + interval: 5s + retries: 5 + start_period: 5s + timeout: 10s + + generator: + build: + dockerfile: scripts/generate_client.Dockerfile + context: ../ + command: "generate -i http://gitea:3000/swagger.v1.json -g rust -o /mnt/generated/" + volumes: + - "../:/mnt/generated/" + depends_on: + gitea: + condition: service_healthy diff --git a/crates/gitea_raw_client/scripts/generate_client.dockerignore b/crates/gitea_raw_client/scripts/generate_client.dockerignore new file mode 100644 index 0000000..2e4fb41 --- /dev/null +++ b/crates/gitea_raw_client/scripts/generate_client.dockerignore @@ -0,0 +1,2 @@ +target/ +git/ diff --git a/crates/gitea_raw_client/scripts/generate_client.entrypoint.sh b/crates/gitea_raw_client/scripts/generate_client.entrypoint.sh new file mode 100755 index 0000000..cecf648 --- /dev/null +++ b/crates/gitea_raw_client/scripts/generate_client.entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +echo "waiting for gitea..." +curl --silent --head --retry 5 --retry-connrefused --retry-delay 0 --max-time 10 --retry-max-time 40 "http://gitea:3000/" > /dev/null + +echo "fetching swagger spec" + +curl -L http://gitea:3000/swagger.v1.json > gitea.swagger.json + +echo "fetched gitea.swagger.json" + +exit 0 + diff --git a/crates/gitea_raw_client/scripts/generate_client.sh b/crates/gitea_raw_client/scripts/generate_client.sh new file mode 100755 index 0000000..1539e7c --- /dev/null +++ b/crates/gitea_raw_client/scripts/generate_client.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +docker compose -f scripts/generate_client.docker-compose.yml build +docker compose -f scripts/generate_client.docker-compose.yml up generator +docker compose -f scripts/generate_client.docker-compose.yml down diff --git a/crates/gitea_raw_client/src/.gitignore b/crates/gitea_raw_client/src/.gitignore new file mode 100644 index 0000000..6aa1064 --- /dev/null +++ b/crates/gitea_raw_client/src/.gitignore @@ -0,0 +1,3 @@ +/target/ +**/*.rs.bk +Cargo.lock diff --git a/crates/gitea_raw_client/src/.openapi-generator-ignore b/crates/gitea_raw_client/src/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/crates/gitea_raw_client/src/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/crates/gitea_raw_client/src/.openapi-generator/FILES b/crates/gitea_raw_client/src/.openapi-generator/FILES new file mode 100644 index 0000000..f132361 --- /dev/null +++ b/crates/gitea_raw_client/src/.openapi-generator/FILES @@ -0,0 +1,336 @@ +.gitignore +.openapi-generator-ignore +.travis.yml +Cargo.toml +README.md +docs/AccessToken.md +docs/AddCollaboratorOption.md +docs/AddTimeOption.md +docs/AdminApi.md +docs/AnnotatedTag.md +docs/AnnotatedTagObject.md +docs/ApiError.md +docs/Attachment.md +docs/Branch.md +docs/BranchProtection.md +docs/CombinedStatus.md +docs/Comment.md +docs/Commit.md +docs/CommitAffectedFiles.md +docs/CommitDateOptions.md +docs/CommitMeta.md +docs/CommitStats.md +docs/CommitStatus.md +docs/CommitUser.md +docs/ContentsResponse.md +docs/CreateAccessTokenOption.md +docs/CreateBranchProtectionOption.md +docs/CreateBranchRepoOption.md +docs/CreateEmailOption.md +docs/CreateFileOptions.md +docs/CreateForkOption.md +docs/CreateGpgKeyOption.md +docs/CreateHookOption.md +docs/CreateIssueCommentOption.md +docs/CreateIssueOption.md +docs/CreateKeyOption.md +docs/CreateLabelOption.md +docs/CreateMilestoneOption.md +docs/CreateOAuth2ApplicationOptions.md +docs/CreateOrgOption.md +docs/CreatePullRequestOption.md +docs/CreatePullReviewComment.md +docs/CreatePullReviewOptions.md +docs/CreateReleaseOption.md +docs/CreateRepoOption.md +docs/CreateStatusOption.md +docs/CreateTagOption.md +docs/CreateTeamOption.md +docs/CreateUserOption.md +docs/CreateWikiPageOptions.md +docs/Cron.md +docs/DeleteEmailOption.md +docs/DeleteFileOptions.md +docs/DeployKey.md +docs/DismissPullReviewOptions.md +docs/EditAttachmentOptions.md +docs/EditBranchProtectionOption.md +docs/EditDeadlineOption.md +docs/EditGitHookOption.md +docs/EditHookOption.md +docs/EditIssueCommentOption.md +docs/EditIssueOption.md +docs/EditLabelOption.md +docs/EditMilestoneOption.md +docs/EditOrgOption.md +docs/EditPullRequestOption.md +docs/EditReactionOption.md +docs/EditReleaseOption.md +docs/EditRepoOption.md +docs/EditTeamOption.md +docs/EditUserOption.md +docs/Email.md +docs/ExternalTracker.md +docs/ExternalWiki.md +docs/FileCommitResponse.md +docs/FileDeleteResponse.md +docs/FileLinksResponse.md +docs/FileResponse.md +docs/GeneralApiSettings.md +docs/GeneralAttachmentSettings.md +docs/GeneralRepoSettings.md +docs/GeneralUiSettings.md +docs/GenerateRepoOption.md +docs/GitBlobResponse.md +docs/GitEntry.md +docs/GitHook.md +docs/GitObject.md +docs/GitTreeResponse.md +docs/GpgKey.md +docs/GpgKeyEmail.md +docs/Hook.md +docs/Identity.md +docs/InternalTracker.md +docs/Issue.md +docs/IssueApi.md +docs/IssueDeadline.md +docs/IssueLabelsOption.md +docs/IssueTemplate.md +docs/Label.md +docs/MarkdownOption.md +docs/MergePullRequestOption.md +docs/MigrateRepoForm.md +docs/MigrateRepoOptions.md +docs/Milestone.md +docs/MiscellaneousApi.md +docs/NodeInfo.md +docs/NodeInfoServices.md +docs/NodeInfoSoftware.md +docs/NodeInfoUsage.md +docs/NodeInfoUsageUsers.md +docs/Note.md +docs/NotificationApi.md +docs/NotificationCount.md +docs/NotificationSubject.md +docs/NotificationThread.md +docs/OAuth2Application.md +docs/Organization.md +docs/OrganizationApi.md +docs/OrganizationPermissions.md +docs/Package.md +docs/PackageApi.md +docs/PackageFile.md +docs/PayloadCommit.md +docs/PayloadCommitVerification.md +docs/PayloadUser.md +docs/Permission.md +docs/PrBranchInfo.md +docs/PublicKey.md +docs/PullRequest.md +docs/PullRequestMeta.md +docs/PullReview.md +docs/PullReviewComment.md +docs/PullReviewRequestOptions.md +docs/Reaction.md +docs/Reference.md +docs/Release.md +docs/RepoCollaboratorPermission.md +docs/RepoCommit.md +docs/RepoTopicOptions.md +docs/RepoTransfer.md +docs/Repository.md +docs/RepositoryApi.md +docs/RepositoryMeta.md +docs/SearchResults.md +docs/ServerVersion.md +docs/SettingsApi.md +docs/StopWatch.md +docs/SubmitPullReviewOptions.md +docs/Tag.md +docs/Team.md +docs/TeamSearch200Response.md +docs/TimelineComment.md +docs/TopicName.md +docs/TopicResponse.md +docs/TrackedTime.md +docs/TransferRepoOption.md +docs/UpdateFileOptions.md +docs/User.md +docs/UserApi.md +docs/UserHeatmapData.md +docs/UserSearch200Response.md +docs/UserSettings.md +docs/UserSettingsOptions.md +docs/WatchInfo.md +docs/WikiCommit.md +docs/WikiCommitList.md +docs/WikiPage.md +docs/WikiPageMetaData.md +git_push.sh +src/apis/admin_api.rs +src/apis/configuration.rs +src/apis/issue_api.rs +src/apis/miscellaneous_api.rs +src/apis/mod.rs +src/apis/notification_api.rs +src/apis/organization_api.rs +src/apis/package_api.rs +src/apis/repository_api.rs +src/apis/settings_api.rs +src/apis/user_api.rs +src/lib.rs +src/models/access_token.rs +src/models/add_collaborator_option.rs +src/models/add_time_option.rs +src/models/annotated_tag.rs +src/models/annotated_tag_object.rs +src/models/api_error.rs +src/models/attachment.rs +src/models/branch.rs +src/models/branch_protection.rs +src/models/combined_status.rs +src/models/comment.rs +src/models/commit.rs +src/models/commit_affected_files.rs +src/models/commit_date_options.rs +src/models/commit_meta.rs +src/models/commit_stats.rs +src/models/commit_status.rs +src/models/commit_user.rs +src/models/contents_response.rs +src/models/create_access_token_option.rs +src/models/create_branch_protection_option.rs +src/models/create_branch_repo_option.rs +src/models/create_email_option.rs +src/models/create_file_options.rs +src/models/create_fork_option.rs +src/models/create_gpg_key_option.rs +src/models/create_hook_option.rs +src/models/create_issue_comment_option.rs +src/models/create_issue_option.rs +src/models/create_key_option.rs +src/models/create_label_option.rs +src/models/create_milestone_option.rs +src/models/create_o_auth2_application_options.rs +src/models/create_org_option.rs +src/models/create_pull_request_option.rs +src/models/create_pull_review_comment.rs +src/models/create_pull_review_options.rs +src/models/create_release_option.rs +src/models/create_repo_option.rs +src/models/create_status_option.rs +src/models/create_tag_option.rs +src/models/create_team_option.rs +src/models/create_user_option.rs +src/models/create_wiki_page_options.rs +src/models/cron.rs +src/models/delete_email_option.rs +src/models/delete_file_options.rs +src/models/deploy_key.rs +src/models/dismiss_pull_review_options.rs +src/models/edit_attachment_options.rs +src/models/edit_branch_protection_option.rs +src/models/edit_deadline_option.rs +src/models/edit_git_hook_option.rs +src/models/edit_hook_option.rs +src/models/edit_issue_comment_option.rs +src/models/edit_issue_option.rs +src/models/edit_label_option.rs +src/models/edit_milestone_option.rs +src/models/edit_org_option.rs +src/models/edit_pull_request_option.rs +src/models/edit_reaction_option.rs +src/models/edit_release_option.rs +src/models/edit_repo_option.rs +src/models/edit_team_option.rs +src/models/edit_user_option.rs +src/models/email.rs +src/models/external_tracker.rs +src/models/external_wiki.rs +src/models/file_commit_response.rs +src/models/file_delete_response.rs +src/models/file_links_response.rs +src/models/file_response.rs +src/models/general_api_settings.rs +src/models/general_attachment_settings.rs +src/models/general_repo_settings.rs +src/models/general_ui_settings.rs +src/models/generate_repo_option.rs +src/models/git_blob_response.rs +src/models/git_entry.rs +src/models/git_hook.rs +src/models/git_object.rs +src/models/git_tree_response.rs +src/models/gpg_key.rs +src/models/gpg_key_email.rs +src/models/hook.rs +src/models/identity.rs +src/models/internal_tracker.rs +src/models/issue.rs +src/models/issue_deadline.rs +src/models/issue_labels_option.rs +src/models/issue_template.rs +src/models/label.rs +src/models/markdown_option.rs +src/models/merge_pull_request_option.rs +src/models/migrate_repo_form.rs +src/models/migrate_repo_options.rs +src/models/milestone.rs +src/models/mod.rs +src/models/node_info.rs +src/models/node_info_services.rs +src/models/node_info_software.rs +src/models/node_info_usage.rs +src/models/node_info_usage_users.rs +src/models/note.rs +src/models/notification_count.rs +src/models/notification_subject.rs +src/models/notification_thread.rs +src/models/o_auth2_application.rs +src/models/organization.rs +src/models/organization_permissions.rs +src/models/package.rs +src/models/package_file.rs +src/models/payload_commit.rs +src/models/payload_commit_verification.rs +src/models/payload_user.rs +src/models/permission.rs +src/models/pr_branch_info.rs +src/models/public_key.rs +src/models/pull_request.rs +src/models/pull_request_meta.rs +src/models/pull_review.rs +src/models/pull_review_comment.rs +src/models/pull_review_request_options.rs +src/models/reaction.rs +src/models/reference.rs +src/models/release.rs +src/models/repo_collaborator_permission.rs +src/models/repo_commit.rs +src/models/repo_topic_options.rs +src/models/repo_transfer.rs +src/models/repository.rs +src/models/repository_meta.rs +src/models/search_results.rs +src/models/server_version.rs +src/models/stop_watch.rs +src/models/submit_pull_review_options.rs +src/models/tag.rs +src/models/team.rs +src/models/team_search_200_response.rs +src/models/timeline_comment.rs +src/models/topic_name.rs +src/models/topic_response.rs +src/models/tracked_time.rs +src/models/transfer_repo_option.rs +src/models/update_file_options.rs +src/models/user.rs +src/models/user_heatmap_data.rs +src/models/user_search_200_response.rs +src/models/user_settings.rs +src/models/user_settings_options.rs +src/models/watch_info.rs +src/models/wiki_commit.rs +src/models/wiki_commit_list.rs +src/models/wiki_page.rs +src/models/wiki_page_meta_data.rs diff --git a/crates/gitea_raw_client/src/.openapi-generator/VERSION b/crates/gitea_raw_client/src/.openapi-generator/VERSION new file mode 100644 index 0000000..d6b4ec4 --- /dev/null +++ b/crates/gitea_raw_client/src/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.3.0-SNAPSHOT \ No newline at end of file diff --git a/crates/gitea_raw_client/src/.travis.yml b/crates/gitea_raw_client/src/.travis.yml new file mode 100644 index 0000000..22761ba --- /dev/null +++ b/crates/gitea_raw_client/src/.travis.yml @@ -0,0 +1 @@ +language: rust