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

347 Коммитов

Автор SHA1 Сообщение Дата
Timothee Guerin 1987a56220
Fix password flow (#3196)
fix [#3137](https://github.com/microsoft/typespec/issues/3137)
2024-04-23 00:53:04 +00:00
Timothee Guerin 1265330298
Update to Body consistency in http request (#2945)
fix [#2868](https://github.com/microsoft/typespec/issues/2868)

- Change meaning of `@body` to mean this is the body and nothing will be
excluded(show warning on containing metadata)
- Add new `@bodyRoot` which has the same purpose as the old `@body`(
Allows changing where the body is resolved from but allows mixing with
metadata.
- Add new `@bodyIgnore` which allows a property to be ignored from the
body
- Provide a new body resolution common function for request and response

also fix #2075
## Examples from original issue

1. [Inconsitency between request and
response](https://cadlplayground.z22.web.core.windows.net/prs/2945/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7Cgp1c2luZyBUeXBlU3BlYy5IdHRwOwoKLyoqCiAqIEJhc2VsaW5lIDE6IEhhdsQqYEBoZWFkZXJgIHByb3BlcnR5IG9ubHkgaW4gcmVxdWVzdMYLc3BvbnNlxAl1bMUTbm8gYm9kecRXUscpxBA6IHZvaWTGFnPFM80WLwpAcm91dGUoIi9i5wCNIikKQGdldCBvcCDIEygg5wCWIGN1c3RvbUjFDTogc3RyaW5nKToge90hIH0g6gD0Q2Fz5QDwQWRkxBtgQHZpc2liaWxpdHlgIHRv9AEBYmVoYXZlIGRpZmZlcmVudGx5IGZvcukBEGFuZOkBES7yAQB7ff8A%2FuUA%2FmNhc2UxIikKb3AgxQso6wCYKCJub%2BQBGOkA5XjuAPvfKsUqIH3vAQMy%2BgEDbm9uIGFubm90YXRlZOoBB%2BoB7GVtcOQBF%2FUB7%2FQA78UU7wDtMuoA7TL1AO3%2FAOXMIuUA3Q%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D)
2. [Inconsitency between different
ways](https://cadlplayground.z22.web.core.windows.net/prs/2945/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CtIZdmVyc2lvbmluZyI7Cgp1c2luZyBUeXBlU3BlYy5IdHRwO9AVVskyOwoKQHNlcnZpY2UKQMdJZWQoxyFzKQpuYW1lc3BhY2UgTXlTxik7CmVudW0gyCQgewogIHYxLMQGMiwKfQoKQHJvdXRlKCJ0MSIpIG9wIHQxKCk6IHZvaWQ7IC8vIDIwNMUNyigyxygyxCh7fccmMM8mM8cmM8UmQGhlYWRlciBmb286IHN0cmluZ9g5NMc5NMY5dmlzaWJpbGl0eSgiZ2F0ZXdheSIp30jFSDXHSDXcSP8AmMxQNsdQNsVQ1THGFiJhYmMifco5N8c5N8U5QGFkZOsBtC52MvMAzsR6IGluIHYxykc4x0c430fFRyzpANpvdGhlcthe&e=%40typespec%2Fopenapi3&options=%7B%7D)

## Breaking changes 
Azure spec PR showing scale of breaking changes
https://github.com/Azure/azure-rest-api-specs/pull/27897
### `@body` means this is the body
This change makes it that using `@body` will mean exactly this is the
body and everything underneath will be included, including metadata
properties. It will log a warning explaining that.

```tsp
op a1(): {@body _: {@header foo: string, other: string} };
                ^ warning header in a body, it will not be included as a header.
```

Solution use `@bodyRoot` as the goal is only to change where to resolve
the body from.

```tsp
op a1(): {@bodyRoot _: {@header foo: string, other: string} };
```




### Empty model after removing metadata and visibility property result
in void always
This means the following case have changed from returning `{}` to no
body

```tsp
op b1(): {};
op b2(): {@visibility("none") prop: string};
op b3(): {@added(Versions.v2) prop: string};
```

Workaround: Use explicit `@body`

```tsp
op b1(): {@body _: {}};
op b2(): {@body _: {@visibility("none") prop: string}};
op b3(): {@body _: {@added(Versions.v2) prop: string}};
```

### Status code always 200 except if response is explicitly `void`

```tsp
op c1(): {@header foo: string}; // status code 200 (used to be 204)
```

Solution: Add explicit `@statusCode`
```tsp
op c1(): {@header foo: string, @statusCode _: 204};
op c1(): {@header foo: string, ...NoContent}; // or spread common model
```


### Properties are not automatically omitted if everything was removed
from metadata or visibility

```tsp
op d1(): {headers: {@header foo: string}}; // body will be {headers: {}}
```

Solution: use `@bodyIgnore`

```tsp
op d1(): {@bodyIgnore headers: {@header foo: string}}; // body will be {headers: {}}
```

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2024-04-17 11:20:25 -07:00
Timothee Guerin 6b3bd9a8f1
Feature: Add Xml library (#3035)
Add xml library following the approved design.
fix #2970

Only minor change was inverting the parmaeters for `@ns(namespace,
prefix` instead of `@namespace(prefix, namespace)` which makes it
clearer with the other overload `@ns(namespace: EnumMember)`

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-04-09 15:33:46 -07:00
Timothee Guerin 29aa4a5ec4
Add release notes release 0.55 - April 2024 (#3093)
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2024-04-02 19:13:46 +00:00
Timothee Guerin d5577b1f11
Docs: Add documentation on emitter scoping (#3016)
fix [#2860](https://github.com/microsoft/typespec/issues/2860)

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2024-04-02 17:51:10 +00:00
emi0x7d1 fbe9da657e
project-root typo corrected in docs (#3083) 2024-04-01 08:10:37 -07:00
Timothee Guerin e31309e5a7
Fix codefixes docs (#3045) 2024-03-28 19:41:27 +00:00
LadyCailin 4e1d30ddce
Update inconsistent docs (#3072)
`@server` works to provide values for the `servers` object, as is
documented elsewhere in the same files. This PR updates the table to
reflect that. Closes #3071.
2024-03-28 13:50:21 +00:00
Jose Manuel Heredia Hidalgo baac24ac00
Fix emitter docs code examples (#3047)
Fixing a couple of wrong, missing, and un-needed imports in the snippets
2024-03-22 22:59:31 +00:00
Timothee Guerin a8f849747c
Clarify multi json part docs (#3014)
fix [#2962](https://github.com/microsoft/typespec/issues/2962)
2024-03-22 03:43:39 +00:00
Timothee Guerin 743c4b0a39
Fix another set of accessibility issues (#3031) 2024-03-19 18:57:02 +00:00
Peter Marcu 9e655a95f5
Fixing alt text on website (#3025)
This PR should make sure there is alt text matching the image name on
each of the image elements.
2024-03-18 07:54:57 -07:00
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 72fb582b3c
Add gif to vscode readme and rerelease (#3003) 2024-03-07 15:46:27 -08:00
Mario Guerra c31aafa07f
grammar fixes (#3000)
First round of website grammar fixes.
2024-03-07 17:25:25 +00:00
Timothee Guerin d5380fb8e1
Add release notes for march 2024 release (#2986) 2024-03-05 13:36:38 -08:00
Timothee Guerin 6a9c62ad24
Feature: Code fixes (#2888)
closes #615

## Code fixes added

### Suppress
![Kapture 2024-02-05 at 15 16
22](https://github.com/microsoft/typespec/assets/1031227/644014a3-9352-4bd4-b1b8-0d314c627405)

### `number` -> `float64` typo fix

![Kapture 2024-02-06 at 09 50
28](https://github.com/microsoft/typespec/assets/1031227/65b2e9aa-c510-440f-a1c6-7851611b65a2)

### Enum to extensible enum in typespec-azure

https://github.com/Azure/typespec-azure/pull/258

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2024-03-05 11:51:21 -08:00
Timothee Guerin abba29c173
Validate playground samples and fix docs to deprecated version (#2977)
fix #1560

Json schema emitter also didn't respect the `noEmit` flag
2024-03-04 23:35:17 +00:00
Allen Zhang cc1774fd6f
Updating doc links to VS Extension (#2971)
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2024-03-01 10:38:10 -08:00
Timothee Guerin fa8b959491
Feature: Spread `Record<T>` (#2920)
fix  #2785
2024-02-29 16:47:23 -08:00
Timothee Guerin 9654dd836b
[OpenAPI3 Emitter] Add option to map `safeint` to `double-int` (#2933)
fix  #2367 
Format was added to the schema registry so we are safe to use that now
https://spec.openapis.org/registry/format/double-int.html

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-02-29 16:05:41 -08: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
Timothee Guerin 8b062e33bb
Update http authentication docs with new operation level auth and scopes (#2960)
PR added support for it but we need to update the docs to explain the
new feature.

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-02-28 19:40:28 +00:00
Vasil Markoukin d2d397cb67
Operation level authentication and scopes (#2901)
Hi! 🖖🏻 
This PR resolves #2624 by implementing the [design
doc](https://gist.github.com/timotheeguerin/56690786e61a436710dd647de9febc0f),
but in its initial form:
- `@useAuth` can now be applied not only to service namespace, but to
interfaces and operations as well. Its arguments override all
authentication, which was set for enclosing scopes.
- OAuth2 scopes can now be set at operation level (though, the code
doing this in OpenAPI emitter is a bit clunky).
- New `NoAuth` authentication option allows to declare optional
authentication (`NoAuth | AnyOtherAuth`) or override authentication to
none in nested scopes.

This implementation does not introduce new `@authScopes` decorator as
design doc comments suggest, and here's why:

1. It does not compose well with `@useAuth` at operation level. For
example
```
...
@useAuth(BasicAuth)
@authScopes(MyOauth2, ["read"])
op gogo(): void
```
Should that be equivalent to `BasicAuth | MyOauth2`, or to `[BasicAuth,
MyOauth2]`?

2. Introducing new decorator would increase complexity, but (imho) it
would not reduce the amount of boilerplate:
```
alias MyOAuth2 = OAuth2Auth<{ ... }>;

@useAuth(MyOAuth2)
@authAcopes(MyOauth2, ["read"])
@service
namepsace Foo;
```
vs
```
model MyOAuth2Flow<T extends string[]>  {  ...  };
alias MyOauth2<T extends string[]> = Oauth2Auth<[MyOauth2Flow[T]]>

@useAuth(MyOAuth2<["read"]>)
@service
namepsace Foo
```

I would be happy to hear any feedback and apply suggested changes.

And thanks for a convenient development setup and thorough test
coverage!

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-02-27 07:39:30 -08:00
Timothee Guerin 02cd6f4d8f
Update encoding.md (#2903) 2024-02-09 21:55:52 +00:00
Timothee Guerin 24d3ba0add
Update docs to clarify range of `numeric`, `integer`, etc. and meaning of unixTimestamp (#2893)
fix #2892 Clarify `numeric`, `integer`, `decimal`, `float`
fix #2887 Clarify unixTimestamp encoding

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-02-09 01:37:32 +00:00
Timothee Guerin 7452fe9a57
Update dependencies - feb 2024 (#2900)
General dependency updates, notable:
- typescript 5.3
- chronus 0.6.0 (BREAKING  THE CHANGELOG FORMAT)
2024-02-08 15:14:01 -08:00
Timothee Guerin 9320c4484d
Add release notes for february relase (#2889) 2024-02-06 13:10:31 -08:00
Timothee Guerin 8ed1d82e7c
Add support for openIdConnect auth scheme (#2811)
fix [#2774](https://github.com/microsoft/typespec/issues/2774)
2024-02-05 14:38:55 -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
Timothee Guerin be9f6d8145
Rename references from microsoft.github.io/typespec to typespec.io (#2858)
All reference but the README as it is being rewritten here
https://github.com/microsoft/typespec/pull/2855
2024-01-30 12:58:42 -08:00
Timothee Guerin 63f7e546fd
Vscode publish (#2838)
Extension
https://marketplace.visualstudio.com/items?itemName=typespec.typespec-vscode
2024-01-29 22:01:33 +00:00
Timothee Guerin 9bf31a65c8
More rush cleanup - bundler uploader (#2841) 2024-01-26 23:02:45 +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 e542ce8991
Fix website docs slug for /docs (#2823)
Issue was we didn't have a doc at `/docs` anymore because the docs
entrypoint was `/docs/introduction/installation`
2024-01-24 12:02:06 -08:00
Mark Cowlishaw f31fae0e48
Add release notes for January release (#2813) 2024-01-23 14:04:06 -08:00
Timothee Guerin 55ea44250d
Vitest improvements: vitest-ui, watch mode for deps, debug config (#2791)
Add vitest ui package and `test:ui` command to popup the vitest UI
https://vitest.dev/guide/ui

Import the common vitest config from the workspace so each package
doesn't need to define all of it.
Added `watchExclude: []` to the common config to preven vitest from
excluding dist and node_modules folder which is required so it can auto
rerun the test on when a dependency (monorepo dep) rebuilds

Added debug config to debug the current test. As the vitest extensions
is quite unreliable this should help
2024-01-22 09:56:55 -08:00
Timothee Guerin 5af94f0762
Website public beta (#2418)
This is a feature branch containing the progress for the website

URL: https://tspwebsitepr.z22.web.core.windows.net/prs/2418/
2024-01-19 09:42:25 -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
Timothee Guerin 55e232d553
Add a new init template to setup a library (#2766)
Add a new library template with:
- `@alernateName` decorator with some custom diagnostics and tests for
it.
- a linter rule and 2 rulesets(`recommended` and `all`)
2024-01-04 12:22:21 -08:00
Timothee Guerin 8d5528363a
Stop warning user when `tsp init` a template without `compilerVersion` specified (#2764)
fix #2741 Add doc for `compilerVersion`
fix #2742 Stop warning
2024-01-04 18:50:02 +00:00
Timothee Guerin 9c7bf80187
Migrate test framework to vitest (#2769)
Get rid of mocha and upgrade to vitest which is a more modern
alternative providing, watch, direct typescript compilation out of the
box, expect library and more.

Advantage over mocha:
- Much better cli
  -  watch mode
  - better diff
- Better extension:
  -  tree organization for files too (not everything flattened)
- update in real time the test(no more need to refresh manually to
discover where are the tests)
  - just a little buggy
- Compiles typescript directly
- provides more expectation apis(like jest)

Cons over mocha: 
- Slower(about 2x) but that means we don't need to build the test as
part of build which would speed up that part(not as much as is lost)

Todo: 
- typespec-azure migration
2024-01-02 11:40:29 -08:00
Timothee Guerin da99aa955b
Detach linter from `$lib` and add state declaration to `$lib` (#2773)
fix #2301 

## Deteach the linter from `$lib`

Having the linter rules defined in `$lib` caused this circular reference
where the rules would call to some accessor that needed the $lib
diagnostics.

With this we keep $lib as manifest and helper functions only.

## Add state key declaration
```ts
export const internalLib = createTypeSpecLibrary({
 state: {
    authentication: { description: "State for the @auth decorator" },
    header: { description: "State for the @header decorator" },
    ...
});

// use with StateKeys.authentication
```
2023-12-22 17:27:00 -08:00
Timothee Guerin 0a77b5f61e
Template engine naming utils (#2765)
## Add 3 new helper functions to be able to change the casing in
templates

```
naming.pascalCase
naming.camelCase
naming.kebabCase
```


## Update the `emitter-ts` to interpolate the emitter name

## Add snapshot test for templates

This way we can see what instantiating the template does at review time
and catch errors that wouldn't make the template crash the e2e test but
would still not be optimal
2023-12-20 21:02:09 +00:00
Timothee Guerin 9aa57063d9
Template for setting up an emitter (#2736)
## Add a new template for scaffolding an emitter

`emitter-ts` template setup the following:
- basic emitter files
- typescript
- test with node test runner with basic test and test host setup
- prettier
- linting with eslint 

## Change to the init area

- Added a new `--template` cli option to allow selecting the template
without a prompt.
- Refactor to make it easier to test. **Note that none of the API is
exposed yet so its just for internal use.**

## Added e2e test for templates

Scafold the template and then run commands like `npm install`, `npm run
build`, `npm run test`, etc. to make sure everything is done correctly.

This is quite costly so might be worth separating in a different step
2023-12-19 16:13:49 -08:00
Will Temple cb92f49e0a
[compiler] Named instantiation of template arguments (#2546)
Implementation of named template arguments as described in #2340.

I added a new syntax node (TemplateArgument), and a cover grammar for
this node:

`<Expression> ('=' <Expression>)?`

Rather than ExpressionNode, the type of a template argument is now
`TemplateArgumentNode`.

If the `=` is parsed, we assert in the parser that the first Expression
must be a "bare identifier" (i.e. a TypeReference with `target:
Identifier`) and unwrap the identifier to produce a clean AST with
`name?: Identifier

Template arguments are evaluated in the order that they were declared,
not in the order they are specified in the instantiation. The new
template argument checker _replaces_ the previous one, and it performs
normalization of argument order and typechecking of template arguments
all in one pass.

TODO:
- [x] Review templates across core libraries to ensure that template
arguments have good names.
- [x] Documentation of new behavior in website.
- [x] Semantic/tmlanguage colorization of tokens. 
- [x] Validate that the AST printer produces the correct text for the
new template argument nodes and that the output is well-formatted.
- [x] Completion of template argument names in argument position.
- [x] Hover context on template argument names in instantiation.

Closes #2340

---------

Co-authored-by: Will Temple <will@wtemple.net>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2023-12-18 14:38:16 -05: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
Travis Prescott 42545acd3b
Improve Emitter/Library authoring documentation (#2725)
Fixes #2728.

---------

Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2023-12-14 21:48:27 +00:00
Mark Cowlishaw e52a32c76a
Prepare Publish for December release (#2740) 2023-12-06 12:43:01 -08:00
Mark Cowlishaw 3fbfbda9a4
Update release notes for December release (#2732) 2023-12-05 17:00:31 -08:00
Timothee Guerin 0b01d954b6
Feature: Add format: absolute-path to options validator (#2708)
fix #2493 

Add a new known format for the json schema validation for emitter
options.

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-12-05 01:35:03 +00:00
Timothee Guerin 360add229e
Feature: String templates (#2630)
fix https://github.com/microsoft/typespec/issues/1591


## String templates
[Playground
examples](https://cadlplayground.z22.web.core.windows.net/prs/2630/?c=aW1wb3J0ICJAdHlwZXNwZWMvanNvbi1zY2hlbWEiOwoKdXNpbmcgVHlwZVNwZWMuSnNvblPFHTsKCkDELMYOCm5hbWVzcGFjZSDGEXM7CgphbGlhcyBteWNvbnN0ID0gImZvb2JhcsRXbW9kZWwgUGVyc29uIHsKICBzaW1wbGU6ICJTxQkgJHsxMjN9IGVuZCI7CiAgbXVsdGlsaW7EIiIiCiAgTcQRIAogxAHHLMUNJHt0cnVlfQogIMQuCiDELzsKCiAgcmVmOiAiUmVmIHRoaXMg5gCcJHvnAJ7KanRlbXBsYXRlOiBUxwo8ImN1c3RvbSI%2BOwp96ADWyR1UIGV4dGVuZHMgdmFsdWVvZiBzdHJpbmc%2B5ADxRm9vICR7VH0g5QD3&e=%40typespec%2Fjson-schema&options=%7B%7D)

```
import "@typespec/json-schema";

using TypeSpec.JsonSchema;

@jsonSchema
namespace Schemas;

alias myconst = "foobar";

model Person {
  simple: "Simple ${123} end";
  multiline: """
  Multi 
     ${123} 
    ${true}
  line
  """;

  ref: "Ref this alias ${myconst} end";
  template: Template<"custom">;
}

alias Template<T extends valueof string> = "Foo ${T} bar";
```

## Other fixes
Also fixes https://github.com/Azure/typespec-azure/issues/3399(Show
invalid escape sequence char instead of the whole string)
<img width="561" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/7592a046-2c2c-4597-acfd-e45ebfb02cb7">

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-12-01 14:33:09 -08:00
Brian Terlson 0b333083c7
Fix small typo in basic extending typespec docs (#2714) 2023-12-01 10:46:20 -08:00
Ding 555eaddf53
Update the link to initialize a library in emitters-basics.md (#2709)
I am following the document to create an emitter and found this link of
steps to initialize a typespec library is not working. So I create this
PR to update the md to point the link to basics.md file, which is for
creating a TypeSpec library.
2023-11-29 12:46:48 -08:00
Timothee Guerin c821ad18b3
fix typo in documentation.md (#2706) 2023-11-28 01:49:28 +00:00
Timothee Guerin 4110e8fc9b
Doc: Tweak to Doc comment doc (#2705)
Remove naming of `TSDoc` and list available tags

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-28 01:17:35 +00:00
Mingzhe Huang cc03604958
fix(docs): bump node requirement to 18 (#2690)
update docs to bump node version from 14/16 to 18, which aligns with tsp
`0.50.0`

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2023-11-22 17:49:36 +00: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
OuJiaHao 8697f61efe
Modify scalar's url in overview.md (#2648)
fixed the scalars's url
2023-11-08 09:30:22 -08:00
Mark Cowlishaw 0bd7e0c5a7
Add release notes for November release (#2645) 2023-11-07 21:31:35 +00:00
Timothee Guerin 0ca049cf13
Migrate out of typesVersions in package.json and cleanup (#2560)
Re-Reverts microsoft/typespec#2554

Making this pr for next release

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-06 19:55:30 +00: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 1599bddb08
Fix formatter docs (#2569)
Describe using quotes around wild card pattern to make sure it is not
partially resolved by `bash`

Related: #2568
2023-10-13 16:04:11 -07:00
Mark Cowlishaw dd8d25d035
Add release notes for October release (#2551) 2023-10-11 12:32:12 -07: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 1a18ef2ac4
Revert "Migrate out of typesVersions in package.json and cleanup" (#2554)
Reverts microsoft/typespec#2488

This PR ends up being a breaking change, will move it to next release
after going through process
2023-10-10 18:01:41 +00:00
Timothee Guerin e02b74a876
Migrate out of typesVersions in package.json and cleanup (#2488)
Same pr in typespec-azure
https://github.com/Azure/typespec-azure/pull/3641

Migrate to use the `types` entry under `exports` instead of hte legacy
typesVersions. This was a leftover to when es modules where not
completely supported in typescript and using typesVersions was a
workaround.
2023-10-04 22:16:08 +00:00
Timothee Guerin c3cd0997b9
Fix linter rule docs using `:` instead of `/` as separator (#2524)
fix #2520
2023-10-02 23:09:48 +00:00
Timothee Guerin 54b6010ebe
Recommend exporting `$lib` when writing a library (#2525)
fix #2519
2023-10-02 14:42:58 -07:00
Timothee Guerin 430dc7e9a8
Website perf improvements (#2507)
Progress in #2480

## `Swc-loader`
Some minor perf improviement. Using `swc-loader` is much faster at
loading the js in the compile stage. This make the timed build nearly
50% faster but it **still gets stuck at** `cache (99%) shutdown
IdleFileCachePlugin` for the vast majority of the time. So this is a
little win but nearly negligable

## Updateing `typedoc-markdown` 

This has changed the file structure to group by folder and has basically
brought back the perf from before the migration to the new doc format.
Not sure why but it works great now.
2023-09-29 12:29:37 -07:00
Timothee Guerin ec1da334e5
Fix website link (#2512)
fix #2510
2023-09-29 18:41:22 +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
Timothee Guerin 61ba17d2d2
General dependencies update september 2023 (#2445)
fix https://github.com/Azure/typespec-azure/issues/3602

Notable change:
- yaml update removes the uncessary escaping of openapi paths
2023-09-21 13:34:11 -07: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
Mark Cowlishaw e3eb6c9df0
Adding release notes for September release (core) (#2407) 2023-09-12 12:53:44 -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
Timothee Guerin 1098447b31
Parse tspconfig as yaml to be able to figure out where errors are (#2273)
fix #2298 
Update yaml parser library from `js-yaml` to `yaml` which allow us to
have an ast and resolve where values are coming from.

Before

<img width="973" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/42149942-f077-4058-808f-e3cda2424649">
Now:
<img width="904" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/f6544f42-7523-489e-b1dd-335a53668292">

On top of providing error locations for config errors that the compiler
can resolve this also setup the base to provide the ability for an
emitter to report na error on its emitter options and show where it is.

---------

Co-authored-by: Microsoft Auto Changeset Bot <autochangesetbot@microsoft.com>
2023-09-08 07:04:39 -07:00
David Wilson ae07658617
Require a semicolon after augment decorator statements (#2343)
This PR fixes #2059 by requiring that a semicolon appear after an
augment decorator statement. This is a breaking change but it should be
mitigated by the fact that the TypeSpec formatter already adds a
semicolon for all augment decorator statements.
2023-09-05 10:10:51 -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 2417239a01
Document comment styles and how to document APIs (#2336)
Fixes #2312.
2023-08-28 22:27:41 +00:00
Travis Prescott 688e5d1e66
Add "Built-in Data Types" to TypeSpec compiler reference (#2328)
Fix #2158.
2023-08-24 11:51:04 -07:00
Mark Cowlishaw 01f5ca599f
Update docs on Record and unknown types (#2305)
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2023-08-21 22:27:46 +00:00
Travis Prescott 39ae3d7504
Add missing `@parameterVisiblity` and `@returnTypeVisibility` docs (#2309)
Pretty much what it says.
2023-08-18 19:53:15 +00:00
Timothee Guerin 747416a7e5
Remove reference to `object` from built-in types (#2304)
It is deprecated and shouldn't be used
2023-08-17 23:28:41 +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
Mark Cowlishaw 3db15286f4
Updating release notes for OpenAPI3 (#2267)
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2023-08-08 19:07:54 +00: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
Mark Cowlishaw 29ddfaec47
Adding release notes for August (#2261)
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2023-08-08 18:20:51 +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
Amir Reza Mehrbakhsh ad2b2c897d
Fix documention minor issues (#2250)
Co-authored-by: AmirReza <amirreza.mehrbakhsh@snapp-pro.market>
2023-08-07 08:07:37 -07:00