Skip to content

HttpLibrary / OpenAPI3 Emitter - Add support for security schema type "mutualTLS" #9266

@codechaotic

Description

@codechaotic

Clear and concise description of the problem

The Problem

TypeSpec does not support defining security schemas of type "mutualTLS" introduced in version 3.1.0 of OAS (spec).

This type is not documented as an Available Schema in the Http Library.

This type does not appear in the enum Http.AuthType when using the VSCode Extension intellisense.
Image

After manually adding the security type "mutualTLS", the openapi3 emitter does not recognize it and logs a warning. The resulting OAS does not include the described securitySchema.

// main.tsp
import "@typespec/http";

using Http;
@service(#{ title: "Demo" })
namespace Demo;

model MutualTLS {
  type: "mutualTLS";
  description: "MutualTLS Authentication";
}

@useAuth(MutualTLS)
op route(): void;
# Execution
$ tsp compile .
TypeSpec compiler v1.7.1

✔ Compiling
⚠ @typespec/openapi3 24ms tsp-output/schema/
Diagnostics were reported during compilation:

main.tsp:5:11 - warning @typespec/openapi3/unsupported-auth: Authentication "mutualTLS" is not a known authentication by the openapi3 emitter, it will be ignored.
> 5 | namespace Demo;
    |           ^^^^

Found 1 warning.
# Output OAS
openapi: 3.1.0
info:
  title: Demo
  version: 0.0.0
tags: []
paths:
  /:
    get:
      operationId: route
      parameters: []
      responses:
        '204':
          description: 'There is no content to send for this request, but the headers may be useful. '
      security:
        - MutualTLS: []
components:
  schemas:
    MutualTLS:
      type: object
      required:
        - type
        - description
      properties:
        type:
          type: string
          enum:
            - mutualTLS
        description:
          type: string
          enum:
            - MutualTLS Authentication

Feature Proposal

  1. Add "mutualTLS" to the enum AuthType in the Http Library
  2. Add support to the VSCode Extension for the newly updated AuthType enum value
  3. Add support to the OpenAPI3 Emitter for the securitySchema type "mutualTLS"

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions