LiveRamp / reslang

A language for describing resource-oriented APIs & turning them into Swagger or resource diagrams. Oriented around the concepts we want to expose in the APIs.
Apache License 2.0
23 stars 7 forks source link

Support server blocks #85

Closed cjea closed 4 years ago

cjea commented 4 years ago

Description

Reslang does not allow users to define server objects, even though they are generated in both openapi and asyncapi docs. Instead, it creates server objects internally by appending strings to hardcoded hostnames (openapi, asyncapi).

Request

Support server objects in Reslang.

Benefits

Proposed syntax

Simplest idea would probably be:

servers {
  "The API server"
  url "api.liveramp.com/my_api"
  scheme "https"

  "LiveRamp Production pubsub instance"
  url "pubsub.liveramp.com"
  port 1883
}

If supporting variables/templating is difficult but desired, that could be addressed in the future and wouldn't block this feature.

michael-gillett commented 4 years ago

However we end up implementing this I would vote that we use host instead of url since url is generally a scheme + host

liveandrew commented 4 years ago

added a fix, merged the PR, and added docs

https://github.com/LiveRamp/reslang/blob/master/docs/server-blocks.md

please re-open if this doesn't suit your needs.