Skip to content

Commit

Permalink
gRPC server
Browse files Browse the repository at this point in the history
  • Loading branch information
alombarte committed Apr 11, 2024
1 parent 9625dda commit bed5a26
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 2 deletions.
46 changes: 45 additions & 1 deletion v2.6/.test.json.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,51 @@
"grpc": {
"catalog": [
"./grpc/definitions"
]
],
"server": {
"services": [
{
"name": "flight_finder.Flights",
"methods": [
{
"name": "FindFlight",
"input_headers": [
"*"
],
"payload_params": {
"page.cursor": "cursor"
},
"backend": [
{
"host": [
"http://localhost:8080"
],
"url_pattern": "/__debug/foo/"
},
{
"host": [
"localhost:4242"
],
"url_pattern": "/flight_finder.Flights/FindFlight",
"extra_config": {
"backend/grpc": {
"use_request_body": true
}
}
},
{
"method": "GET",
"host": [
"http://localhost:8000"
],
"url_pattern": "/articles.json?q={cursor}"
}
]
}
]
}
]
}
},
"auth/validator": {
"shared_cache_duration": 5,
Expand Down
90 changes: 89 additions & 1 deletion v2.6/grpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"properties": {
"catalog": {
"title": "Catalog definition",
"description": "The paths to the different `.pb` files you want to load, or the paths to directories containing `.pb` files. All content is scanned in the order of the list, and after fetching all files it resolves the dependencies of their imports. The order you use here is not important to resolve imports, but it matters when there are conflicts (different files using the same namespace and package type).\n\nSee: https://www.krakend.io/docs/backends/grpc/",
"description": "The paths to the different `.pb` files you want to load, or the paths to directories containing `.pb` files. All content is scanned in the order of the list, and after fetching all files it resolves the dependencies of their imports. The order you use here is not important to resolve imports, but it matters when there are conflicts (different files using the same namespace and package type).\n\nSee: https://www.krakend.io/docs/enterprise/grpc/server/",
"type": "array",
"examples": [
"./grpc/flights.pb",
Expand All @@ -23,6 +23,94 @@
"items": {
"type": "string"
}
},
"server": {
"title": "gRPC Server",
"description": "Defines the gRPC server properties.\n\nSee: https://www.krakend.io/docs/enterprise/grpc/server/",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^[@$_#]": {}
},
"properties": {
"services": {
"title": "gRPC services",
"description": "Defines one object per available gRPC service.\n\nSee: https://www.krakend.io/docs/enterprise/grpc/server/",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^[@$_#]": {}
},
"properties": {
"name": {
"title": "gRPC name",
"description": "The name of the published gRPC service.\n\nSee: https://www.krakend.io/docs/enterprise/grpc/server/",
"type": "string",
"examples": [
"flight_finder.Flights"
]
},
"methods": {
"title": "Methods",
"description": "The gRPC methods available for this service (this is not related with HTTP methods despite using the same name).\n\nSee: https://www.krakend.io/docs/enterprise/grpc/server/",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^[@$_#]": {}
},
"properties": {
"name": {
"title": "Method name",
"description": "The name of the published gRPC method.\n\nSee: https://www.krakend.io/docs/enterprise/grpc/server/",
"type": "string",
"examples": [
"FindFlight"
]
},
"payload_params": {
"description": "Maps a property of the gRPC incoming payload to a `{parameter}` that you can inject and reuse in a `url_pattern`. It supports dot nation to access nested objects.\n\nSee: https://www.krakend.io/docs/enterprise/grpc/server/",
"type": "object",
"examples": [
{
"some.grpc.object": "param1"
}
]
},
"input_headers": {
"title": "Allowed Headers In",
"description": "Defines the list of all client headers that you can use as gRPC metadata.\nBy default, KrakenD won't pass any header from the client to the backend. This list is **case-insensitive**. You can declare headers in lowercase, uppercase, or mixed.\nAn entry `[\"X-Something\"]` forwards a single `X-Something` header to the backend, ignoring everything else. A single star element `[\"*\"]` as value forwards everything to the backend (**it's safer to avoid this option**).",
"type": "array",
"uniqueItems": true,
"default": [],
"examples": [
"X-Custom-Trace",
"*"
],
"items": {
"type": "string"
}
},
"backend": {
"type": "array",
"title": "Backend",
"description": "An array with all the [backend objects](https://www.krakend.io/docs/backends/) mapped to this method",
"items": {
"type": "object",
"$ref": "backend.json"
},
"minItems": 1
}
}
}
}
}
}
}
}
}
}
}

0 comments on commit bed5a26

Please sign in to comment.