Граф коммитов

86 Коммитов

Автор SHA1 Сообщение Дата
Timothee Guerin d8576effd5
Website & Docs Cleanup (#3002)
Co-authored-by: Mario Guerra <85648637+mario-guerra@users.noreply.github.com>
Co-authored-by: Libba Lawrence <llawrence@microsoft.com>
Co-authored-by: Allen Zhang <allenzhang@live.com>
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-03-11 18:56:35 -07:00
Timothee Guerin 02ed01e79b
Improved ref docs for model (#2951)
fix https://github.com/Azure/typespec-azure-pr/issues/3861
fix #2232
Generate docs for model properties and reference models within the same
package
<img width="1213" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/ae7eccd0-97d8-401e-b07f-3375c7b41446">
2024-02-29 07:21:13 -08:00
Will Temple 15f6dbe150
[compiler] Add optional validation message to `@pattern` decorator. (#2863)
Closes #2718

This change adds support for an optional message that emitters may use
to communicate the context of a pattern validation error.

I also added some baseline tests for `@pattern` since there were none in
decorators.spec.ts.

---------

Co-authored-by: Will Temple <will@wtemple.net>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-02-02 02:32:51 +00:00
Jordan Danford 9f556004ec
Clean up capitalization, parentheses, and phrasing in docs (#2817)
I updated library documentation links
(https://microsoft.github.io/typespec/libraries =>
https://typespec.io/docs/libraries), should I update the other
https://microsoft.github.io links as well?
2024-01-25 10:40:16 -08:00
Timothee Guerin 8f4ee2dfdc
Feature: `@encodedName` decorator (#2779)
fix [#2650](https://github.com/microsoft/typespec/issues/2650)

- [x] Add `@encodedName` decorator in the compiler
- [x] Add support in openapi3 emitter 
- [x] update docs

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2024-01-12 21:28:31 +00:00
Will Temple aae7166f0a
Rename template parameters for clarity and consistency (#2726)
This is in preparation for merging named template argument
instantiation.

---------

Co-authored-by: Will Temple <will@wtemple.net>
2023-12-18 13:44:37 -05:00
Timothee Guerin c749b1148f
Split libraries from standard library (#2674)
Having the std and other libraries merged together always made it harder

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-21 20:13:40 +00:00
Timothee Guerin dea0c83804
Docs: multipart default handling (#2667)
part of https://github.com/microsoft/typespec/issues/2419


https://tspwebsitepr.z22.web.core.windows.net/prs/2667/next/standard-library/http/multipart.html

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-21 19:37:05 +00:00
Timothee Guerin 38aa320002
Add ref docs for linter rules (#2668)
Add some generated doc for the linter capability of a library.

Each linter rule can also provide a url pointing to the the full
documentation where we can get a more detailed set of examples of what
is good and what is bad.

Example for http linter 

https://tspwebsitepr.z22.web.core.windows.net/prs/2668/next/standard-library/http/reference/linter.html



![image](https://github.com/microsoft/typespec/assets/1031227/81c2dddc-fa0f-40dd-bad7-9d193f764c55)


![image](https://github.com/microsoft/typespec/assets/1031227/36652cd5-418b-43b9-bd9a-aff046cbe538)

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-15 13:03:36 -08:00
Timothee Guerin adba3b92e6
Upgrade to docusaurus 3.0 (#2628)
Docusaurus 3.0 was just released, this new version brings up 
- react 18 which allows us to not use an outdated version here
- config can use typescript
- some perf improvement(however we already were proactive so its not
very noticable)

https://docusaurus.io/blog/releases/3.0

Typespec azure PR https://github.com/Azure/typespec-azure/pull/3823
2023-11-06 10:24:24 -08:00
Timothee Guerin 6eab70c9bc
Clarify that int and decimal bigInt, bigDecimal (#2608)
fix [#2396](https://github.com/microsoft/typespec/issues/2396)
2023-11-01 15:26:14 +00:00
Timothee Guerin 8d24f2f571
Add unixtimestamp32 to standard lib (#2579)
fix #2543
2023-10-18 19:03:41 +00:00
Travis Prescott af5ad70b27
Update targets for Versioning decorators (#2580)
Fix #2497.

Clarifies which TypeSpec types these decorators can _actually_ be used
on by-design.

**BREAKING CHANGE** This is a breaking change because if unsupported
elements were previously decorated with these (i.e. Namespaces) those
will now throw an error.
2023-10-18 17:06:12 +00:00
Timothee Guerin ebc8ce6fa0
Validate docs have a `title:` and fix for astro migration (#2561)
Astro requires every doc to have a title. Adding a simple script to
validate that so we don't have to patch things when migrating.
2023-10-11 17:09:05 +00:00
Timothee Guerin 2a58761173
Update getting started doc for http (#2502)
fix [#2333](https://github.com/microsoft/typespec/issues/2333)

I went through the docs and copied the samples as I went to make sure
everything was working fine.

With `tsp compile . --watch` you get a nice result with this doc now.

---------

Co-authored-by: Mike Kistler <mikekistler@microsoft.com>
2023-09-28 21:45:37 +00:00
Timothee Guerin 9a2a1bf771
Feature: Add support for `@returns` and `@errors` doc comment tags (#2436)
fix  #2384
2023-09-25 14:33:18 -07:00
Travis Prescott a5fc253410
Core documentation - generate data type docs programmatically (#2467)
Fixes #2297.
2023-09-25 09:50:32 -07:00
Timothee Guerin f9c9a945b3
Allow `@oneOf` of model property (#2473) 2023-09-25 15:45:07 +00:00
Travis Prescott 681cf10016
Change `OpenAPI` namespace to `TypeSpec.OpenAPI` (#2439)
Fixes #2351.

This is a breaking change. 

**TODO**
- [x] typespec-azure companion PR:
https://github.com/Azure/typespec-azure/pull/3599
2023-09-19 13:45:32 -07:00
Timothee Guerin 9355c969b6
Clarify default encoding responsability (#2387)
fix [#2256](https://github.com/microsoft/typespec/issues/2256)
2023-09-11 15:36:05 -07:00
Ali Rahimi H c42321c71c
fix useAuth decorator link to authentication section (#2317)
Fix the link syntax and target

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: David Wilson <david@daviwil.com>
2023-08-30 05:11:35 -07:00
Travis Prescott 688e5d1e66
Add "Built-in Data Types" to TypeSpec compiler reference (#2328)
Fix #2158.
2023-08-24 11:51:04 -07:00
Travis Prescott 39ae3d7504
Add missing `@parameterVisiblity` and `@returnTypeVisibility` docs (#2309)
Pretty much what it says.
2023-08-18 19:53:15 +00:00
Will Temple 1b8b27e3d9
[protobuf] Add `omit-unreachable-types` (#2281)
This PR tweaks the way that models are included in output specifications
when they are not referenced by operations and adds an option for
controlling this behavior.

The option is `omit-unreachable-types` after the OpenAPI v3 emitter
which uses the same name, and the behavior in the protobuf emitter is
similar. If a message is expliclty decorated with `@message` or is
referenced direclty or indirectly by an operation/method, it will be
emitted. Otherwise, it will be emitted if (1) it is a direct child of a
`package` namespace AND (2) ALL of its fields are annotated with
`@field` AND (3) the `omit-unreachable-types` option is not set to true.

Closes #1879

---------

Co-authored-by: Will Temple <will@wtemple.net>
2023-08-10 16:12:21 -04:00
Mike Kistler 6e5f5e24f6
Handle general encodings for utcDateTime (#2251)
This PR revises the logic for encodings on utcDateTime and
offsetDateTime to set the `format` to the `encoding` value for any
unrecognized values. For backward compatibility, a special case is added
for `rfc7231` which maps to `format: date-time-rfc7231`.

Tests and docs are updated.

## Update

Revised this PR to map rfc7231 to http-date in the openapi3 emitter.

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-08-08 18:34:04 +00:00
Timothee Guerin 7cce379d3e
Render README from refdoc (#2242)
fix #2130 

Generate the README.md for typespec libraries automatically using the
subset of the content as what gets included in the ref doc

To achieve this I reoganized the markdown rendering to be able to
provide a reusable system that can be cusomized for different markdown
engines.

- The markdown renderer will render a markdown compatible with Github
Flavored Markdown.
- The docusuaurs rendererer extends the markdown renderer and include a
few extra metadata.
2023-08-07 22:24:56 +00:00
Timothee Guerin 668a7632d3
Fix `useRef` decorator (#2243)
fix #2239

`useRef` decorator in openapi3 library was missing `valueof` for ref
paramater which led to it saving the `StringLiteral` object instead of
the actual ref string.
2023-08-07 20:09:48 +00:00
Timothee Guerin 89daef8453
Fix content type docs (#2245)
fix #2237 

Also fix the invalid enum syntax in docs #2240

---------

Co-authored-by: Mike Kistler <mikekistler@microsoft.com>
2023-08-07 16:16:20 +00:00
Mike Kistler 1da2628060 Update doc for openapi developers 2023-08-04 14:32:53 -05:00
Timothee Guerin adbb1559cd
Rename `ref-doc` package to `tspd` and provide a cli that can be used by each package (#2225)
Progress towards providing the ref doc generation as a usable tool by
any typespec library.

Detach the generation from the website, instead each package define
where they want their doc and we generate it.

This adds a new `tspd` package and CLI tool that is meant to be used by
library authors. It will have the following functionalities
- generate docs
- generate TS signatures
- lint library?

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-08-01 22:34:18 +00:00
David Wilson c5e0a4d3be
Add `#deprecated` directive and `--ignore-deprecated` compiler option (#2205)
This PR fixes #2107 by implementing the proposed `#deprecated` directive
to replace the old `@deprecated` decorator.
2023-07-27 18:34:30 +03:00
Timothee Guerin 0a9063789a
Add docs for default encoding, discriminator or content type negotiation (#2181)
fix #1960 (Discriminator docs)
fix #1920 (Default interpretations)
partial work for https://github.com/Azure/typespec-azure/issues/2960


## Move discriminator doc to compiler

Moved and expanded the small discriminator doc present in the http
library. As discriminator is a compiler decorator and there is nothing
specific about http.

https://cadlwebsite.z1.web.core.windows.net/prs/2181/next/standard-library/discriminated-types


## Add documentation on how types are encoded in http 

Describe the default behaviors as well as how to configure

https://cadlwebsite.z1.web.core.windows.net/prs/2181/next/standard-library/http/encoding

## Add content negotiation docs

Add general http docs on how to define different content negotiation

https://cadlwebsite.z1.web.core.windows.net/prs/2181/next/standard-library/http/content-types

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2023-07-13 21:51:27 -04:00
Timothee Guerin 5e53967899
Feature: Add new `@info` decorator (#2169)
fix [#980](https://github.com/microsoft/typespec/issues/980)

Add new `@info` decorator providing the ability to specify the
additional fields from openapi info object.

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2023-07-12 15:47:49 +00:00
Brian Terlson 411700a908
Add docs for JSON Schema (#2120) 2023-06-26 20:06:23 -07:00
Timothee Guerin 0c923b80da
Stop including `x-typespec-name` by default (#2118)
fix [#1029](https://github.com/microsoft/typespec/issues/1029)


Add an option `include-x-typespec-name` which can be 2 option:
- `inline-only` when a schema is inline (Previous behavior)
- `never` **DEFAULT**. Never included.
2023-06-26 19:15:56 -07:00
David Wilson b1eb314d3f
Deprecate `@list` decorator in favor of `rest`'s `@listsResource` (#2093)
This change fixes #1978 by deprecating the virtually-unused `@list`
decorator in favor of the `@listsResource` decorator in
`@typespec/rest`. I'm also deprecating the associated `isListOperation`
and `getListOperationType` functions in `@typespec/compiler` and moving
`isListOperation` to the REST library.

The corresponding `typespec-azure` PR is here:
https://github.com/Azure/typespec-azure/pull/3200

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2023-06-22 11:15:25 -07:00
Timothee Guerin 41ed4f35a5
Add docs documenting the header name auto resolution (#2104) 2023-06-22 14:48:57 +00:00
Timothee Guerin 8277fdf25f
Provide a better formatting for properties with comments and decorators (#2089) 2023-06-19 10:38:24 -07:00
Timothee Guerin 6733c5b0a8
Feature: `valueof` for string, numeric and boolean literals (#1877) 2023-06-02 13:35:00 -07:00
Timothee Guerin afd531aa2b
Fix: Array shouldn't be assignable to empty model `{}` (#1814) 2023-06-01 19:36:57 -07:00
Timothee Guerin 832cb1176d
Fix encoding in openapi3 + add docs and samples (#1985) 2023-05-31 08:19:48 -07:00
Timothee Guerin 1df806a63d
Fix: Example in doc commment would only be rendered for decorators (#1988) 2023-05-30 20:35:27 -07:00
Timothee Guerin d01cd2d21f
Validate decorator has a signature and add missing (#1977) 2023-05-25 14:13:16 -07:00
Eddy Ashton 4514667dc5
Update links in Http Authentication standard library docs (#1980) 2023-05-25 08:04:32 -07:00
Travis Prescott 01b75f905d
Improve @encode error messages. (#1963)
* Fixes #1951.

* Update error message.

* Opt 1?

* Code review feedback.
2023-05-24 16:50:50 +00:00
Travis Prescott 51b2de947e
Fix decorator signature in docs (#1959)
* Fix decorator display logic.

* Regen docs.
2023-05-23 16:00:00 +00:00
Timothee Guerin 59091e50dd
Emitter options generated doc (#1945) 2023-05-19 11:43:28 -07:00
Timothee Guerin 2fcbd887bc
Missing examples in generated docs (#1949) 2023-05-18 15:06:36 -07:00
Travis Prescott fad0849b27
Add interface operation docs (#1913)
* Add interface operation docs. Fixes #1901.

* Regenerate REST docs with interface operations.

* Update missing documentation rule.

* Resolve missing REST docs and regenerate ref.

* Resolve CI.
2023-05-09 15:41:32 +00:00
Timothee Guerin 2774e45b26
Fix template instance in template should be marked partially instantiated (#1867) 2023-05-08 13:16:09 -07:00