Shorten homepage examples (#2830)
<img width="1444" alt="image" src="https://github.com/microsoft/typespec/assets/1031227/50dc70ef-793c-46b8-ab86-ddfbe251d6a0">
This commit is contained in:
Родитель
ba025338e7
Коммит
abd213cd48
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
"@typespec/prettier-plugin-typespec": patch
|
||||
"@typespec/eslint-config-typespec": patch
|
||||
"@typespec/eslint-plugin": patch
|
||||
"@typespec/internal-build-utils": patch
|
||||
"tmlanguage-generator": patch
|
||||
"@typespec/html-program-viewer": patch
|
||||
"@typespec/playground-website": patch
|
||||
"@typespec/bundle-uploader": patch
|
||||
"typespec-vscode": patch
|
||||
"@typespec/best-practices": patch
|
||||
"@typespec/library-linter": patch
|
||||
"@typespec/json-schema": patch
|
||||
"typespec-vs": patch
|
||||
"@typespec/playground": patch
|
||||
"@typespec/versioning": patch
|
||||
"@typespec/compiler": patch
|
||||
"@typespec/openapi3": patch
|
||||
"@typespec/protobuf": patch
|
||||
"@typespec/bundler": patch
|
||||
"@typespec/openapi": patch
|
||||
"@typespec/samples": patch
|
||||
"@typespec/website": patch
|
||||
"@typespec/http": patch
|
||||
"@typespec/rest": patch
|
||||
"@typespec/spec": patch
|
||||
"@typespec/tspd": patch
|
||||
"@typespec/e2e": patch
|
||||
---
|
||||
|
||||
Clean up docs
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
---
|
|
@ -7,6 +7,7 @@
|
|||
"build": "pnpm -r --workspace-concurrency=Infinity --aggregate-output --reporter=append-only build ",
|
||||
"check-format": "pnpm run prettier --check",
|
||||
"check-version-mismatch": "syncpack list-mismatches",
|
||||
"change": "changeset",
|
||||
"clean": "pnpm -r run clean",
|
||||
"cspell": "cspell --no-progress \"**/*.{md,ts,tsx}\" ",
|
||||
"dogfood": "pnpm install && pnpm build && pnpm -r dogfood",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
}
|
||||
|
||||
.split-windows {
|
||||
height: 700px;
|
||||
height: 600px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import openapiTsp from "!!raw-loader!@site/static/tsp-samples/openapi3/hero/main.tsp";
|
||||
import openapiYaml from "!!raw-loader!@site/static/tsp-samples/openapi3/hero/out/openapi.yaml";
|
||||
import openapiTsp from "!!raw-loader!@site/static/tsp-samples/homepage/hero/http/main.tsp";
|
||||
import openapiYaml from "!!raw-loader!@site/static/tsp-samples/homepage/hero/http/out/openapi.yaml";
|
||||
|
||||
import jsonSchemaTsp from "!!raw-loader!@site/static/tsp-samples/json-schema/hero/main.tsp";
|
||||
import jsonSchemaOutput from "!!raw-loader!@site/static/tsp-samples/json-schema/hero/out/schema.yaml";
|
||||
import jsonSchemaTsp from "!!raw-loader!@site/static/tsp-samples/homepage/hero/json-schema/main.tsp";
|
||||
import jsonSchemaOutput from "!!raw-loader!@site/static/tsp-samples/homepage/hero/json-schema/out/schema.yaml";
|
||||
|
||||
import protobufTsp from "!!raw-loader!@site/static/tsp-samples/protobuf/hero/main.tsp";
|
||||
import protobufOutput from "!!raw-loader!@site/static/tsp-samples/protobuf/hero/out/addressbook.proto";
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import "@typespec/http";
|
||||
|
||||
using TypeSpec.Http;
|
||||
|
||||
model Store {
|
||||
name: string;
|
||||
address: Address;
|
||||
}
|
||||
|
||||
model Address {
|
||||
street: string;
|
||||
city: string;
|
||||
}
|
||||
|
||||
@route("/stores")
|
||||
interface Stores {
|
||||
list(@query filter: string): Store[];
|
||||
read(@path id: Store): Store;
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: (title)
|
||||
version: 0000-00-00
|
||||
tags: []
|
||||
paths:
|
||||
/stores:
|
||||
get:
|
||||
operationId: Stores_list
|
||||
parameters:
|
||||
- name: filter
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: The request has succeeded.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Store'
|
||||
/stores/{id}:
|
||||
get:
|
||||
operationId: Stores_read
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/components/schemas/Store'
|
||||
responses:
|
||||
'200':
|
||||
description: The request has succeeded.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Store'
|
||||
components:
|
||||
schemas:
|
||||
Address:
|
||||
type: object
|
||||
required:
|
||||
- street
|
||||
- city
|
||||
properties:
|
||||
street:
|
||||
type: string
|
||||
city:
|
||||
type: string
|
||||
Store:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- address
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
address:
|
||||
$ref: '#/components/schemas/Address'
|
|
@ -0,0 +1,4 @@
|
|||
emit: ["@typespec/openapi3"]
|
||||
options:
|
||||
"@typespec/openapi3":
|
||||
emitter-output-dir: "{project-root}/out"
|
|
@ -0,0 +1,25 @@
|
|||
import "@typespec/json-schema";
|
||||
|
||||
using TypeSpec.JsonSchema;
|
||||
|
||||
@jsonSchema
|
||||
namespace Schemas;
|
||||
|
||||
model Person {
|
||||
name: string;
|
||||
address: Address;
|
||||
@uniqueItems nickNames?: string[];
|
||||
cars?: Car[];
|
||||
}
|
||||
|
||||
model Address {
|
||||
street: string;
|
||||
city: string;
|
||||
country: string;
|
||||
}
|
||||
|
||||
model Car {
|
||||
kind: "ev" | "ice";
|
||||
brand: string;
|
||||
@minValue(1900) year: int32;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
$schema: https://json-schema.org/draft/2020-12/schema
|
||||
$id: schema.yaml
|
||||
$defs:
|
||||
Address:
|
||||
$schema: https://json-schema.org/draft/2020-12/schema
|
||||
$id: Address
|
||||
type: object
|
||||
properties:
|
||||
street:
|
||||
type: string
|
||||
city:
|
||||
type: string
|
||||
country:
|
||||
type: string
|
||||
required:
|
||||
- street
|
||||
- city
|
||||
- country
|
||||
Car:
|
||||
$schema: https://json-schema.org/draft/2020-12/schema
|
||||
$id: Car
|
||||
type: object
|
||||
properties:
|
||||
kind:
|
||||
anyOf:
|
||||
- type: string
|
||||
const: ev
|
||||
- type: string
|
||||
const: ice
|
||||
brand:
|
||||
type: string
|
||||
year:
|
||||
type: integer
|
||||
minimum: 1900
|
||||
maximum: 2147483647
|
||||
required:
|
||||
- kind
|
||||
- brand
|
||||
- year
|
||||
Person:
|
||||
$schema: https://json-schema.org/draft/2020-12/schema
|
||||
$id: Person
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
address:
|
||||
$ref: Address
|
||||
nickNames:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
uniqueItems: true
|
||||
cars:
|
||||
type: array
|
||||
items:
|
||||
$ref: Car
|
||||
required:
|
||||
- name
|
||||
- address
|
|
@ -0,0 +1,5 @@
|
|||
emit: ["@typespec/json-schema"]
|
||||
options:
|
||||
"@typespec/json-schema":
|
||||
emitter-output-dir: "{project-root}/out"
|
||||
bundleId: schema.yaml
|
|
@ -80,15 +80,7 @@ paths:
|
|||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- address
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
address:
|
||||
$ref: '#/components/schemas/Address'
|
||||
$ref: '#/components/schemas/Store'
|
||||
responses:
|
||||
'200':
|
||||
description: The request has succeeded.
|
||||
|
|
Загрузка…
Ссылка в новой задаче