openpgp4fpr:2a420f2982e589326ca49d1b0644b87ed144c988

  • 0 Posts
  • 25 Comments
Joined 1 year ago
cake
Cake day: June 30th, 2023

help-circle


  • Honestly not sure about Swagger, I’ve only ever used swagger-ui to show the API docs on a webpage. OpenAPI as a standard and openapi-generator are not abandoned and quite active. I’ll give you an example of how I use it.

    I have a FastAPI server in python that defines some endpoints and data models that it can work with, it exports an openapi.json definition. I also have a common schemas library defined with pydantic that also exports an openapi.json (python was chosen to make it easier for other team members to make quick changes). This schemas library is also imported in the FastAPI app, basically only the data models are shared.

    I use the FastAPI/openapi.json to generate C++ code in one application (the end user app) using the openapi-generator-cli, serialize/deserialize is handled by the generated code, since the pydantic schema is a dependency of the FastAPI server, both the endpoints and data models get generated. The pydantic/openapi.json is also used by our frontend written in typescript to generate data models only since the frontend doesn’t need to call FastAPI directly but it has an option to in the future by generating from FastAPI/openapi.json instead.

    This ensures that we’re using the same schema across all codebases. When I make changes to the schema, the code gets re-generated and included in the new c++/web app builds. There’s multiple ways to go about versioning, but for data only schema I’d just keep it backwards compatible forever (by adding new props as optional field rather than required and slowly deprecating/removing props that are no longer used).

    I found this to be more convoluted than just using something like gRPC/Protobuf (which can also be serialized from JSON), I’ve used it before and it was great. But for other devs that need to change a few lines of python and not having to deal with protobuf compiler, it’s a more frictionless solution at the cost of more moving parts and some CICD setup on my side.







  • When setting up nvim-treesitter neither clang nor msvc worked. Rather, it worked and compiled the necessary libs but the treesitter plugin failed to load the necessary .so libs. The common troubleshooting steps didn’t help (setting up clang as preferred compiler etc.), so I just ended up installing zig and that helped to get it working.




  • hosakatoForgejoHow to fork a github repo to forgejo?
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 months ago

    You can push mirror your fork back to GitHub when you deem necessary (e.g when it’s in a good shape) and create a PR to the parent repo automatically using forgejo runner script, you’d just need to make an API token. If the goal is to automate PRs. If the goal is to not use GitHub for your forks but still continue to make PRs, you can’t work around that I think. Unless there’s a way to PR a bunch of patch files perhaps?