Skip to content

Commit 4621772

Browse files
committed
Rename media fields (#1624)
1 parent ce91238 commit 4621772

File tree

4 files changed

+1703
-1698
lines changed

4 files changed

+1703
-1698
lines changed

compiler/src/model/metamodel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ export class Endpoint {
384384
since?: string
385385
stability?: Stability
386386
visibility?: Visibility
387-
accept?: string[]
388-
contentType?: string[]
387+
requestMediaType?: string[]
388+
responseMediaType?: string[]
389389
privileges?: {
390390
index?: string[]
391391
cluster?: string[]

compiler/src/steps/add-content-type.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,21 @@ import * as model from '../model/metamodel'
2222
import { JsonSpec } from '../model/json-spec'
2323

2424
/**
25-
* Adds the `accept` and `contentType` fields to every endpoint
26-
* from the rest-api-spec if present.
25+
* Adds the `responseMediaType` (accept in the rest-api-spec)
26+
* and `responseMediaType` (content_type in the rest api spec)
27+
* fields to every endpoint from the rest-api-spec if present.
2728
*/
2829
export default async function addContentType (model: model.Model, jsonSpec: Map<string, JsonSpec>): Promise<model.Model> {
2930
for (const endpoint of model.endpoints) {
3031
const spec = jsonSpec.get(endpoint.name)
3132
assert(spec, `Can't find the json spec for ${endpoint.name}`)
3233

3334
if (Array.isArray(spec.headers.accept)) {
34-
endpoint.accept = spec.headers.accept
35+
endpoint.responseMediaType = spec.headers.accept
3536
}
3637

3738
if (Array.isArray(spec.headers.content_type)) {
38-
endpoint.contentType = spec.headers.content_type
39+
endpoint.requestMediaType = spec.headers.content_type
3940
}
4041
}
4142

0 commit comments

Comments
 (0)