Skip to content

Instantly share code, notes, and snippets.

@nguerrera
Created August 24, 2020 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nguerrera/0621e7d58e69aabe948e037f5b5bb0db to your computer and use it in GitHub Desktop.
Save nguerrera/0621e7d58e69aabe948e037f5b5bb0db to your computer and use it in GitHub Desktop.

Make friendly client names

directive:
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].post.responses["200"].schema
    transform: >
      $["x-ms-client-name"] = "content";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].post.responses["200"].headers["X-Schema-Type"]
    transform: >
      $["x-ms-client-name"] = "serializationType";
  - from: swagger-document
    where: $.paths["/$schemagroups/getSchemaById/{schema-id}"].get.responses["200"].headers["X-Schema-Id"]
    transform: >
      $["x-ms-client-name"] = "id";
  - from: swagger-document
    where: $.paths["/$schemagroups/getSchemaById/{schema-id}"].get.responses["200"].headers["X-Schema-Id-Location"]
    transform: >
      $["x-ms-client-name"] = "locationById";
  - from: swagger-document
    where: $.paths["/$schemagroups/getSchemaById/{schema-id}"].get.responses["200"].headers["X-Schema-Version"]
    transform: >
      $["x-ms-client-name"] = "version";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].post.responses["200"].headers["X-Schema-Type"]
    transform: >
      $["x-ms-client-name"] = "serializationType";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].post.responses["200"].headers["X-Schema-Id"]
    transform: >
      $["x-ms-client-name"] = "id";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].post.responses["200"].headers["X-Schema-Id-Location"]
    transform: >
      $["x-ms-client-name"] = "locationById";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].post.responses["200"].headers["X-Schema-Version"]
    transform: >
      $["x-ms-client-name"] = "version";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].put.responses["200"].headers["X-Schema-Type"]
    transform: >
      $["x-ms-client-name"] = "serializationType";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].put.responses["200"].headers["X-Schema-Id"]
    transform: >
      $["x-ms-client-name"] = "id";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].put.responses["200"].headers["X-Schema-Id-Location"]
    transform: >
      $["x-ms-client-name"] = "locationById";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].put.responses["200"].headers["X-Schema-Version"]
    transform: >
      $["x-ms-client-name"] = "version";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment