Skip to content

OpenAPI Specification (OAS) support #7744

Open
@MajorLift

Description

@MajorLift

New Feature / Enhancement Checklist

  • I am not disclosing a vulnerability.
    I am not just asking a question.
    I have searched through existing issues.

Current Limitation

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

Feature / Enhancement Description

1. Serialization of Parse Server instances into OpenAPI documents

  • Many major services including Github, Twitter etc. publish API details in OAS 3.1 format.
  • "An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases."
  • OpenAPI supports specification of full range of REST API functionality including multiple servers/endpoints/methods/headers/parameters, request/response formats, authorization/authentication details, callbacks/webhooks etc.

2. Code generation feature for deserializing OpenAPI definitions into fully functional Parse Server instances.

  • Would enable a Infrastructure as Code (IaC) workflow (e.g. Docker Compose, Ansible, Terraform, ...) where the developer only needs to write out a REST API as a declarative configuration file, and Parse Server automatically handles the implementation of the interface.

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

  • I would be willing to make contributions on this feature if there is any interest.
  • I'm not completely familiar with this amazing project yet, so if I'm somehow way off mark with this, please don't hesitate to point it out.

Activity

parse-github-assistant

parse-github-assistant commented on Dec 24, 2021

@parse-github-assistant

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!
mtrezza

mtrezza commented on Dec 25, 2021

@mtrezza
Member

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

MajorLift commented on Dec 27, 2021

@MajorLift
Author

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

mtrezza commented on Dec 27, 2021

@mtrezza
Member

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:

  • a) writing the adapter mechanism so that one can optionally plug in the OAS API adapter, or GraphQL API adapter (which is currently hard coded into Parse Server, but could/should move then out of the core codebase), or any other future API adapter
  • b) writing the OAS adapter itself

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

MajorLift commented on Dec 29, 2021

@MajorLift
Author

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

dani69654 commented on Jan 21, 2022

@dani69654

Following.

mtrezza

mtrezza commented on Jan 21, 2022

@mtrezza
Member

@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.

added
bounty:$100Bounty applies for fixing this issue (Parse Bounty Program)
on Jan 21, 2022
mtrezza

mtrezza commented on Jan 27, 2022

@mtrezza
Member

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

MajorLift

MajorLift commented on Feb 9, 2022

@MajorLift
Author

@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.

pinned this issue on May 6, 2022

2 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$100Bounty applies for fixing this issue (Parse Bounty Program)type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mtrezza@MajorLift@dani69654

        Issue actions

          OpenAPI Specification (OAS) support · Issue #7744 · parse-community/parse-server