{"id":20768179,"url":"https://github.com/softwaremill/tapir-scalaxb-example","last_synced_at":"2025-08-01T14:13:44.418Z","repository":{"id":137885082,"uuid":"538914265","full_name":"softwaremill/tapir-scalaxb-example","owner":"softwaremill","description":"This project showcases how to implement xml serialization / deserialization in Tapir, using code generated by Scalaxb.","archived":false,"fork":false,"pushed_at":"2022-09-28T09:39:54.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-01-18T06:42:44.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/softwaremill.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":"2022-09-20T09:45:35.000Z","updated_at":"2022-09-22T09:28:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"82e765c3-6b5e-45b8-b010-688fdf0d32c3","html_url":"https://github.com/softwaremill/tapir-scalaxb-example","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/softwaremill%2Ftapir-scalaxb-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Ftapir-scalaxb-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Ftapir-scalaxb-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Ftapir-scalaxb-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softwaremill","download_url":"https://codeload.github.com/softwaremill/tapir-scalaxb-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243098013,"owners_count":20235941,"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":[],"created_at":"2024-11-17T11:36:16.602Z","updated_at":"2025-03-11T19:28:39.720Z","avatar_url":"https://github.com/softwaremill.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tapir Scalaxb Example\n\nThis project showcases how to implement xml serialization / deserialization in [Tapir](https://github.com/softwaremill/tapir), using code generated by [Scalaxb](https://github.com/eed3si9n/scalaxb).\n\n## Project overview\n\nProject exposes one endpoint, named \"xml\", that consumes xml object - `Outer`:\n```xml\n\u003couter xmlns=\"http://www.example.com/innerouter\"\u003e\n    \u003cfoo\u003e\n        \u003ca\u003e42\u003c/a\u003e\n        \u003cb\u003etrue\u003c/b\u003e\n        \u003cc\u003ehorses\u003c/c\u003e\n    \u003c/foo\u003e\n    \u003cbar\u003ecats\u003c/bar\u003e\n\u003c/outer\u003e\n```\nand returns a \"reversed\" version of it\n```xml\n\u003couter xmlns=\"http://www.example.com/innerouter\" xmlns:innerouter=\"http://www.example.com/innerouter\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\u003e\n  \u003cfoo\u003e\n    \u003ca\u003e-42\u003c/a\u003e\n    \u003cb\u003efalse\u003c/b\u003e\n    \u003cc\u003esesroh\u003c/c\u003e\n  \u003c/foo\u003e\n  \u003cbar\u003estac\u003c/bar\u003e\n\u003c/outer\u003e\n```\n\nWhen running at localhost, the endpoint could be accessed using `curl`:\n```shell\ncurl -X 'POST' \\\n        'http://localhost:8080/xml' \\\n        -H 'accept: application/xml' \\\n        -H 'Content-Type: application/xml' \\\n        -d '\u003couter xmlns=\"http://www.example.com/innerouter\"\u003e\n    \u003cfoo\u003e\n        \u003ca\u003e42\u003c/a\u003e\n        \u003cb\u003etrue\u003c/b\u003e\n        \u003cc\u003ehorses\u003c/c\u003e\n    \u003c/foo\u003e\n    \u003cbar\u003ecats\u003c/bar\u003e\n\u003c/outer\u003e'\n```\nor viewed in swagger at [http://localhost:8080/docs](http://localhost:8080/docs).\n\nThe `Outer` object model, serialization, and deserialization logic is a part of code generated by `scalaxb` based on XML Schema definition file, located at `src/main/xsd/InnerOuter.xsd`.\nThe code responsible for integrating code generated by `scalaxb` with `tapir` is located in `xml` package.\nThe key file is named `TapirXmlScalaxb` as it implements `XmlCodec[T]` enabling integration.\nIts usage could be looked up in `Endpoints` file as well as in tests in `EndpointsSpec` or `TapirXmlScalaxbTest`.\n\nPlease notice, that just after opening the project in the IDE of your choosing, several symbols might appear in red as they cannot be resolved.\nThis is because the scalaxb code is not generated yet.\nCompilation of code (or simply running the project) would generate missing files and fix \"symbol not resolved\" errors.\n\n## Running project\n\nIf you have [sbt](https://www.scala-sbt.org) installed, you can use the standard commands:\n```shell\nsbt compile # build the project\nsbt test # run the tests\nsbt run # run the application (Main)\n```\n\nIf you don't have [sbt](https://www.scala-sbt.org) installed, you can use the provided wrapper script:\n```shell\n./sbtx -h # shows an usage of a wrapper script\n./sbtx compile # build the project\n./sbtx test # run the tests\n./sbtx run # run the application (Main)\n```\n\nFor more details check the [sbtx usage](https://github.com/dwijnand/sbt-extras#sbt--h) page.\n\n## Docs\n[Tapir documentation](https://tapir.softwaremill.com/en/latest/)\n\n[Tapir - Codecs](https://tapir.softwaremill.com/en/latest/endpoint/codecs.html)\n\n[Scalaxb documentation](https://scalaxb.org/)\n\n[Setup scalaxb as sbt plugin](https://scalaxb.org/sbt-scalaxb)\n\n[Running scalaxb](https://scalaxb.org/running-scalaxb)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Ftapir-scalaxb-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftwaremill%2Ftapir-scalaxb-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Ftapir-scalaxb-example/lists"}