parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.85k stars 4.78k forks source link

OpenAPI Specification (OAS) support #7744

Open MajorLift opened 2 years ago

MajorLift commented 2 years ago

New Feature / Enhancement Checklist

Current Limitation

There is no support for the OpenAPI Specification (OAS) standard.

Feature / Enhancement Description

1. Serialization of Parse Server instances into OpenAPI documents

Example Use Case

Detailed in above section.

Alternatives / Workarounds

Unaware of any other than manually transcribing OAS documents into Parse Server configuration.

3rd Party References

Remarks

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!

mtrezza commented 2 years ago

It would be interesting to find an adapter-like concept to add such APIs. We currently have a GraphQL implementation which was implemented as a fixed part of parse server, but over time it became clear that such a deep implementation poses unnecessary challenges for deployments that do not make use of that API. And when another "standard" comes along like the OAS, then it cannot be easily swapped.

So the first step for this feature could be a design for how such an adapter-like API interface could look like. Then, gradually one could start to implement the API, until it dies off organically, like other standards have.

MajorLift commented 2 years ago

Thank you for the feedback @mtrezza ! If I'm understanding correctly, you're suggesting first writing a generic interface based on parse server's current feature set, and then writing a shim/compatibility layer tailored to the current version of OAS on top of that?

That does seem to be a lot more maintainable and flexible way of going about this. Being able to insulate parse server's adapter interface from minor changes in the standard would be a valuable feature.

It also seems in that case that I won't be able to make any contributions on my own until I'm much more familiar with the codebase. I'll be onboarding myself, but in the meantime I'll welcome any guidance, ideas, or general comments from the team.

mtrezza commented 2 years ago

If I'm understanding correctly, you're suggesting first writing a generic interface based on parse server's current feature set

Maybe that generic interface does already exist - we could use the REST API which always has the complete set of features, because it's the basis for every Parse client SDK. It's also well documented. REST is probably the most basic form of API that has been around for long and will stay with us for the foreseeable future. Then all that's needed is:

I'll be onboarding myself, but in the meantime I'll welcome any guidance, ideas, or general comments from the team.

You could take a look at the various existing adapters in Parse Server (database, etc) to get inspiration for the API adapter mechanism. At the same time you could write the OAS adapter with just a few basic features (e.g. create & delete object), as you will probably get more insight as you so along. Then you could add a few more basic features and we can release it for developers to try out, while you can continue to make more features available in the OAS adapter and hopefully others will contribute and maybe do a few implementations as well.

MajorLift commented 2 years ago

You could take a look at the various existing adapters in Parse Server (database, etc) to get inspiration for the API adapter mechanism. At the same time you could write the OAS adapter with just a few basic features (e.g. create & delete object)

These seem like excellent starting points. OAS is a standard specifically for describing REST APIs, so implementing basic CRUD functionality first and building on that seems like a good approach. I'll look into the existing adapters in the codebase and see if I can whip something up.

dani69654 commented 2 years ago

Following.

mtrezza commented 2 years ago

@MajorLift Nice, I'll add a bounty to this, as I think it would be quite a great extension to make Parse Server more versatile and interoperable. And it could lighten the footprint of Parse Server if it allows us to move GraphQL out of the core codebase.

mtrezza commented 2 years ago

What would a rough roadmap look like for this issue and where would the swagger file fit into it?

MajorLift commented 2 years ago

@mtrezza Sorry for the late response! I'm still interested in working on this, but I've been onboarding at a new position and just haven't had the time. I'll let you know once I'm more available.

I think starting with implementing serialization of a parse server instance into an openapi document (i.e. swagger file) preferrably using the existing API adapters might make sense, as it will have deterministic output, and the modules written in the process could be built upon to make the adapter more extensible/standard-agnostic, which would lay the groundwork for implementing the deserialization feature.