{"id":18374762,"url":"https://github.com/jasujm/hrefs","last_synced_at":"2026-03-12T15:37:49.085Z","repository":{"id":45257855,"uuid":"430142234","full_name":"jasujm/hrefs","owner":"jasujm","description":"Hyperlinks for pydantic models","archived":false,"fork":false,"pushed_at":"2025-02-05T19:03:50.000Z","size":232,"stargazers_count":16,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-28T05:03:02.984Z","etag":null,"topics":["api","fastapi","hrefs","pydantic","python","rest","starlette"],"latest_commit_sha":null,"homepage":"https://hrefs.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasujm.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","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":"2021-11-20T15:42:16.000Z","updated_at":"2025-02-05T19:03:49.000Z","dependencies_parsed_at":"2023-12-05T21:31:30.856Z","dependency_job_id":"c3e33f14-28bc-4d6e-b16a-5951a080b82e","html_url":"https://github.com/jasujm/hrefs","commit_stats":{"total_commits":114,"total_committers":1,"mean_commits":114.0,"dds":0.0,"last_synced_commit":"800b779358480918cf273f4374d5295601d195a3"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/jasujm/hrefs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasujm%2Fhrefs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasujm%2Fhrefs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasujm%2Fhrefs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasujm%2Fhrefs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasujm","download_url":"https://codeload.github.com/jasujm/hrefs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasujm%2Fhrefs/sbom","scorecard":{"id":507801,"data":{"date":"2025-08-11","repo":{"name":"github.com/jasujm/hrefs","commit":"b1153d5c598f366185ae16db5353a005c562d63d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 12 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T23:41:51.268Z","repository_id":45257855,"created_at":"2025-08-19T23:41:51.268Z","updated_at":"2025-08-19T23:41:51.268Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30430962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","fastapi","hrefs","pydantic","python","rest","starlette"],"created_at":"2024-11-06T00:15:56.082Z","updated_at":"2026-03-12T15:37:49.052Z","avatar_url":"https://github.com/jasujm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hyperlinks for pydantic models\n==============================\n\nRead `a blog post from the library author\n\u003chttps://www.jmoisio.eu/en/blog/2023/03/12/a-library-for-managing-hyperlinks-in-modern-python-web-applications/\u003e`_\ndiscussing why this library exists.\n\nIn a typical web application relationships between resources are modeled by\nprimary and foreign keys in a database (integers, UUIDs, etc.). The most natural\nway to represent relationships in REST APIs is by URLs to the related resources\n(explained in `this blog\n\u003chttps://cloud.google.com/blog/products/application-development/api-design-why-you-should-use-links-not-keys-to-represent-relationships-in-apis\u003e`_).\n\n``hrefs`` makes it easy to add hyperlinks between `pydantic\n\u003chttps://pydantic-docs.helpmanual.io/\u003e`_ models in a declarative way. Just\ndeclare a ``Href`` field and the library will automatically convert between keys\nand URLs:\n\n.. code-block:: python\n\n   from hrefs import Href, BaseReferrableModel\n   from pydantic import BaseModel\n\n   class Book(BaseReferrableModel):\n       id: int\n\n       class Config:\n           details_view = \"get_book\"\n\n   class Library(BaseModel):\n       books: list[Href[Book]]\n\n   @app.get(\"/books/{id}\")\n   def get_book(id: int) -\u003e Book:\n       return Book(id=id)\n\n   @app.get(\"/library\")\n   def get_library() -\u003e Library:\n       \"\"\"\n       Will serialize into:\n       {\"books\":[\"https://example.com/books/1\",\"https://example.com/books/2\",\"https://example.com/books/3\"]}\n       \"\"\"\n       return Library(books=[1,2,3])\n\n   @app.post(\"/library\")\n   def post_library(library: Library):\n       \"\"\"\n       Assuming the request contains\n       {\"books\":[\"https://example.com/books/1\",\"https://example.com/books/2\",\"https://example.com/books/3\"]}\n       Will deserialize into: [1,2,3]\n       \"\"\"\n       write_to_database([href.key for href in library.books])\n\n``hrefs`` was written especially with `FastAPI \u003chttps://fastapi.tiangolo.com/\u003e`_\nin mind, but integrates into any application or framework using pydantic to\nparse and serialize models.\n\nCheck out the `documentation \u003chttps://hrefs.readthedocs.io/\u003e`_ to get started!\n\nInstallation\n------------\n\nInstall the library using ``pip`` or your favorite package management tool:\n\n.. code-block:: console\n\n   $ pip install hrefs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasujm%2Fhrefs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasujm%2Fhrefs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasujm%2Fhrefs/lists"}