Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 18 2018 06:06
    QuantumGhost starred reproto/reproto
  • Dec 04 2018 11:58
    iilyak starred reproto/reproto
  • Nov 19 2018 15:25
    j-channings starred reproto/reproto
  • Nov 18 2018 03:32
    billykwok starred reproto/reproto
  • Nov 17 2018 21:55
    LucioFranco starred reproto/reproto
  • Oct 31 2018 08:39
    darksv starred reproto/reproto
  • Oct 18 2018 17:41
    turol starred reproto/reproto
  • Oct 13 2018 08:55

    udoprog on wip

    wip Update test (compare)

  • Oct 13 2018 06:34

    udoprog on wip

    Large refactoring for how to ha… wip (compare)

  • Oct 12 2018 18:57

    udoprog on generics

    Cargo Format Parse type parameters (compare)

  • Oct 12 2018 18:57

    udoprog on master

    Bump dependencies and use dirs … Rework how interfaces are gener… Bump integration tests (compare)

  • Oct 12 2018 16:22
    udoprog labeled #59
  • Oct 12 2018 16:21
    udoprog edited #59
  • Oct 12 2018 14:51

    udoprog on master

    Eval: Implement Dart and bump d… Eval: Update Eval: Bump dependencies (compare)

  • Oct 11 2018 11:16

    udoprog on eval

    Dart: Initial Commit Dart: Add keywords and clean up… Dart: enum decoding and partial… and 15 more (compare)

  • Oct 11 2018 11:04
    udoprog edited #61
  • Oct 11 2018 11:04
    udoprog edited #61
  • Oct 11 2018 11:04
    udoprog edited #61
  • Oct 11 2018 11:04
    udoprog edited #61
  • Oct 11 2018 11:04
    udoprog edited #61
Christophe Biocca
@christophebiocca
Hello, you pinged me on reddit.
John-John Tedro
@udoprog
Hey! Yeah, I have a couple of questions and it felt like Reddit isn't the best fit.
Christophe Biocca
@christophebiocca
Fair enough.
John-John Tedro
@udoprog
How do you use the spec to validate your API implementation, if I read it correct?
Christophe Biocca
@christophebiocca
Ok, so we're currently using python. This means that we have 0 type checking by default. So the json dict is compared to the format of the spec.
John-John Tedro
@udoprog
Programmatically, through code generated from the spec?
Christophe Biocca
@christophebiocca
Actually we have something internally that generates the spec, the docs and the validation code all at once. Nice for restrictions that can't be expressed by the spec (they end up in the documentation instead).
Example:
@organizations.get(
    response={
        200: endpoint.ResponseType(
            description='A list of `Organization`s visible to the authenticated bot.',
            schema=schema.Shape(attrs=[
                schema.Shape.Attr(
                    key='list',
                    schema=schema.ArrayOf(OrganizationWrapper.schema),
                    read=schema.Enforce.REQUIRED,
                    write=schema.Enforce.DISALLOWED,
                )
            ]),
        )
    },
    tags=[PublicApiTag.Organization],
)
As a decorator to the actual function.
John-John Tedro
@udoprog
Ah, cool. How much effort did you spend building your tooling? Anything you want to contribute upstream? :)
Christophe Biocca
@christophebiocca
I can't claim credit. I originally wrote the GRPC-based API. My cofounder did the rewrite to use swagger.
2-3 days to build the new abstractions, thankfully the actual implementation only changed slightly. Unfortunately this isn't in a nice contributable format (it's not built on top of anything in particular anyways, we'd have to make a new project just to host it).
John-John Tedro
@udoprog
Ah. Also, I agree with your statement regarding gRPC, it isn't really well-supported for public APIs. It's really good, but not ubiquitous. My company is looking into deploying it wider which is why I have experience with it. But it's also only used for service-to-service communication.
So the tooling you built is loading the schema, wrapping the endpoints with validation and documentation?
Christophe Biocca
@christophebiocca
Generating the actual schema. The python code is the single source of truth.
John-John Tedro
@udoprog
Oh. So the schema is primarily used for documentation - assuming your framework does the rest?
And potentially if users wanted to use the OpenAPI spec to codegen their own things?
Christophe Biocca
@christophebiocca
Yes.
Obviously not great for versioning because it can change with no warning. But we see how the schema is changed so we can catch that at review time.
John-John Tedro
@udoprog
Yeah. But it is IMO a really good way of doing things.
So your users primarily write API calls by hand? Do you provide a client library that they can install?
John-John Tedro
@udoprog
A challenge we're having is providing high quality libraries to use internally for our services (Web + Java + Python), which is unsurprisingly why I focused on those languages and codegening the most code-intensive parts of them first. But it's definitely a different use-case.
Christophe Biocca
@christophebiocca
We have all of 3 beta-testing customers for the public API, most of whom hired a third party to actually integrate with the system. When we were using GRPC each implementor had issues:
  • The first one couldn't use the PHP GRPC libraries because they weren't available on a stable RedHat distro yet.
  • The second one uses an Enterprise Service Bus, so they need json/soap requests they can input into it manually.
  • The third one struggled with the library, partly due to unfamiliarity but also partly because GRPC-PHP had bugs. When we wrote sample code for them we found a serious bug. It had been fixed 6 hours prior so we just had to update but that was pure luck.
John-John Tedro
@udoprog
PHP gRPC? The Java impl didn't really materialize until this year. Mainly due to to a lack of support for ALPN; https://github.com/grpc/grpc-java/blob/master/SECURITY.md - but also a couple of nasty bugs like futures which never completed, etc... I can only imagine what the PHP implementation is going through :D
Before netty-tcnative-boringssl-static it was an absolute PITA to use.
Christophe Biocca
@christophebiocca
Well most GRPC libraries just wrap the C implementation. Incidentally that was the dealbreaker for implementer #1 (required native PHP extensions, not possible to just copy a library into their project).
John-John Tedro
@udoprog
Ah OK.
That's another one I haven't had the pleasure of dealing with yet.
So no client libs?
Christophe Biocca
@christophebiocca
No custom wrappers no. Could have gone that way but that still wouldn't have worked with implementer 2. Giving them the documentation has seemed to be enough for them all now: https://encircleinc.github.io/public-api/?encircleUrl=https%3A//api.encircleapp.com/openapi_v3.json
John-John Tedro
@udoprog
Yeah. It's a different environment. But I really appreciate you sharing. Generating an OpenAPI spec could definitely be a goal for the project at some point. For you it probably wouldn't make much of a difference in practice seeing as you already have well-integration tooling and workflow.
But an issue is open right now to support defining HTTP endpoints. And structure is getting into place to support it. The problem was primarily designing first-class syntax for it. But the current approach would leverage the existing service declaration with the addition of rust-style attributes. But it's all just a grand experiment in the end :).
Plus an OpenAPI backend is definitely not out of the question. There's some really neat tooling to make use of in that ecosystem.
John-John Tedro
@udoprog
But again, thanks for sharing! Gotta go now. If there's any suggestions for things you'd like to see or other things you hate with the project, please tell me.