{"id":15478537,"url":"https://github.com/phogolabs/inflate","last_synced_at":"2026-05-17T15:02:09.253Z","repository":{"id":95297686,"uuid":"225041004","full_name":"phogolabs/inflate","owner":"phogolabs","description":"A Golang reflection package on steroids","archived":false,"fork":false,"pushed_at":"2022-12-19T13:49:39.000Z","size":77,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T15:56:04.454Z","etag":null,"topics":["golang","golang-reflection","open-api","reflect"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phogolabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-11-30T16:41:51.000Z","updated_at":"2023-04-05T17:00:36.000Z","dependencies_parsed_at":"2023-06-18T15:38:59.032Z","dependency_job_id":null,"html_url":"https://github.com/phogolabs/inflate","commit_stats":null,"previous_names":["phogolabs/reflectify"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phogolabs%2Finflate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phogolabs%2Finflate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phogolabs%2Finflate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phogolabs%2Finflate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phogolabs","download_url":"https://codeload.github.com/phogolabs/inflate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246042013,"owners_count":20714147,"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":["golang","golang-reflection","open-api","reflect"],"created_at":"2024-10-02T04:05:37.910Z","updated_at":"2026-02-26T20:08:43.049Z","avatar_url":"https://github.com/phogolabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inflate\nA Golang reflection package on steroids\n\n[![Documentation][godoc-img]][godoc-url]\n[![License][license-img]][license-url]\n[![Build Status][action-img]][action-url]\n[![Coverage][codecov-img]][codecov-url]\n[![Go Report Card][report-img]][report-url]\n\n## Motivation\n\nThe project is motivated from the fact that there are no packages that\nconvert values based on different criteria:\n\n- Convert values based on OpenAPI parameters serialization format\n- Sets the default value defined by tag attribute\n- Sets the structure fields from another structure or map by using tag attribute\n\nThe library works in greedy manner. It tries to convert incompatible values as\nmuch as it can. Thanks for the inspiration to the contributors of the following\nprojects:\n\n- [mapstructure](https://github.com/mitchellh/mapstructure)\n- [defaults](https://github.com/creasty/defaults)\n- [copier](https://github.com/jinzhu/copier)\n\n## Installation\n\n```console\n$ go get -u github.com/phogolabs/inflate\n```\n\n## Usage\n\nThe basic usage of the package gives some handy features.\n\nIf you want to convert a value from one type to another, you can use the\nfollowing function:\n\n```golang\ntype Order struct {\n  ID string `field:\"order_id\"`\n}\n\ntype OrderItem struct {\n  OrderID string `field:\"order_id\"`\n}\n```\n\n```golang\nsource := \u0026Order{ID: \"0000123\"}\ntarget := \u0026OrderItem{}\n\nif err := inflate.Set(target, source); err != nil {\n  panic(err)\n}\n\nfmt.Printf(\"%+v\", target)\n\n// Output: \u0026{OrderID:0000123}\n```\n\nYou can use the package to set the default values (if they are not set):\n\n```golang\ntype Address struct {\n\tCity    string `json:\"city\"`\n\tCountry string `json:\"country\"`\n}\n\ntype Profile struct {\n\tName    string  `default:\"John\"`\n\tAddress Address `default:\"{\\\"city\\\":\\\"London\\\",\\\"country\\\":\\\"UK\\\"}\"`\n}\n\n```\n\n```golang\nprofile := \u0026Profile{}\n\nif err := inflate.SetDefault(profile); err != nil {\n\tpanic(err)\n}\n\nfmt.Printf(\"%+v\", profile)\n\n// Output:\n// \u0026{Name:John Address:{City:London Country:UK}}\n```\n\nThe package supports serialization of parameters in [OpenAPI spec](https://swagger.io/docs/specification/serialization/) format.\nFor more advanced examples, please read the online documentation.\n\n## Contributing\n\nWe are open for any contributions. Just fork the\n[project](https://github.com/phogolabs/inflate).\n\n[report-img]: https://goreportcard.com/badge/github.com/phogolabs/inflate\n[report-url]: https://goreportcard.com/report/github.com/phogolabs/inflate\n[logo-author-url]: https://www.freepik.com/free-vector/abstract-cross-logo-template_1185919.htm\n[logo-license]: http://creativecommons.org/licenses/by/3.0/\n[codecov-url]: https://codecov.io/gh/phogolabs/inflate\n[codecov-img]: https://codecov.io/gh/phogolabs/inflate/branch/master/graph/badge.svg\n[action-img]: https://github.com/phogolabs/inflate/workflows/main/badge.svg\n[action-url]: https://github.com/phogolabs/inflate/actions\n[godoc-url]: https://godoc.org/github.com/phogolabs/inflate\n[godoc-img]: https://godoc.org/github.com/phogolabs/inflate?status.svg\n[license-img]: https://img.shields.io/badge/license-MIT-blue.svg\n[license-url]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphogolabs%2Finflate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphogolabs%2Finflate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphogolabs%2Finflate/lists"}