Closed irvinesunday closed 1 week ago
The implementation of this should basically be the same as setExtension
helper.
but setInfoExtension(key: string, value: unknown): void
and then add those values to the info data
Maybe it can be workaround for now? @irvinesunday Typespec:
import "@typespec/http";
import "@typespec/rest";
import "@typespec/openapi";
import "@typespec/openapi3";
using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.OpenAPI;
/**
* This is a sample server Petstore server.
*/
@info({
title: "title - info",
"x-cutome-info": {
name_for_human: "Suno";
description_for_human: "Suno is a tool that can generate songs based on a description. The user provides a description of the song they want to create, and Suno generates the song lyrics. Suno is a fun and creative way to create songs for any occasion.";
logo_url: "https://th.bing.com/th?id=OSK.935650835684F7E18AC3F31034DE6DF3";
contact_email: "ionutro@microsoft.com";
privacy_policy_url: "https://app.suno.ai/privacy";
legal_info_url: "https://app.suno.ai/legal";
},
})
@service
namespace PetStore;
@extension("x-custom", "My value")
op readxxx(): string;
Result:
openapi: 3.0.0
info:
title: title - info
x-cutome-info:
name_for_human: Suno
description_for_human: Suno is a tool that can generate songs based on a description. The user provides a description of the song they want to create, and Suno generates the song lyrics. Suno is a fun and creative way to create songs for any occasion.
logo_url: https://th.bing.com/th?id=OSK.935650835684F7E18AC3F31034DE6DF3
contact_email: ionutro@microsoft.com
privacy_policy_url: https://app.suno.ai/privacy
legal_info_url: https://app.suno.ai/legal
description: This is a sample server Petstore server.
version: 0.0.0
tags: []
paths:
/:
get:
operationId: readxxx
parameters: []
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: string
x-custom: My value
components: {}
Clear and concise description of the problem
Given the below Typespec example, which passes a custom decorator
@skill()
on a namespace that aims to extend the OpenApiinfo
object via extensions:main.tsp
The expected OpenApi file output should be:
openapi.yaml
However, this is currently not supported. We need to have a way of extending an OpenApi
info
object via extensions.Checklist