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

API descriptor generator #52

Open
pshirshov opened this issue Jul 26, 2018 · 2 comments
Open

API descriptor generator #52

pshirshov opened this issue Jul 26, 2018 · 2 comments
Assignees

Comments

@pshirshov
Copy link
Member

We may implement a tool converting a JSON into a set of model drafts.

This API call:

{
  "personalizations": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "John Doe"
        }
      ],
      "subject": "Hello, World!"
    }
  ],
  "from": {
    "email": "[email protected]",
    "name": "Sam Smith"
  },
  "reply_to": {
    "email": "[email protected]",
    "name": "Sam Smith"
  }
}

may be translated into

data emailuser {
   email: str
   name: str
}

data emailData {
   to: list[emailuser]
   subject: str
}

data {
   personalizations: list[emailData]
   from: emailUser
   reply_to: emailUser
}

This may allow us to interoperate with simple REST data providers.

Also we may convert swagger and other popular formats into our models. Kinda related: #19

@pshirshov pshirshov self-assigned this Jul 26, 2018
@ratoshniuk ratoshniuk self-assigned this Sep 24, 2018
@ratoshniuk
Copy link

ratoshniuk commented Sep 24, 2018

@pshirshov How get should deal with follow input?

"from": {
    "email": "[email protected]",
    "name": "Sam Smith"
  },
  "reply_to": {
    "email": "[email protected]",
    "name": "Sam Smith"
    "extra_field" : "foo"    // new field!
  }

Either:

// One for both inputs
data emailUser {
    email : str
    name : str
    extraField : opt[str]
}

or

data emailUser {
    email : str
    name : str
}

data emailUserWithExtra {
    email : str
    name : str
    extraField : str
}

@pshirshov
Copy link
Member Author

I guess second one. From what I can see first one requires a complex and fragile heuristic.

@neko-kai neko-kai transferred this issue from 7mind/izumi Mar 15, 2020
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

No branches or pull requests

2 participants