Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property ref #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Property ref #24

wants to merge 2 commits into from

Conversation

erdnaxeli
Copy link
Contributor

This PR based on the work done on #23. It allows to use a ref in a property object, as defined by the OpenAPI v3 spec.

builder.add(Swagger::Object.new("User", "object"))
builder.add(
  Swagger::Object.new(
    "Post",
    "object"
    [
      Swagger::Property("content"),
      Swagger::Property("author", "object", ref: "User"),
    ],
)

I think it is obvious that I am duplicating the code that was in Swagger::Objects::Schema to Swagger::Objects::Property. Actually in the OpenAPI v3 spec they are both the same. The properties dict is Hash(String, Schema).

So I would like to propose to merge those two types. For the user facing API we can keep the Swagger::Object and Swagger::Property distinction, but for the OpenAPI generation I don't think it brings any advantage.

@erdnaxeli erdnaxeli marked this pull request as draft February 5, 2021 16:56
@icyleaf icyleaf marked this pull request as ready for review March 25, 2021 02:34
@icyleaf
Copy link
Owner

icyleaf commented Mar 25, 2021

CI failed because the code was not formatted. please run the command below and commit:

crystal tool format src
crystal tool format spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants