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

46 Коммитов

Автор SHA1 Сообщение Дата
Timothee Guerin e0dfe6f5d0
Grammar: Fix comments in template params not tokenized (#3018)
fix #3017

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2024-03-22 02:53:07 +00:00
Timothee Guerin 077db13c8d
Generate TypeScript decorator signatures from `extern dec` (#2122)
Note this is added to `tspd` which is not published yet so this can be
iterated over without any issues.

Adds a decorator signature generator. Generates 2 files:
- `<namespace>.ts` : Contains the decorator signatures that can be
imported and when declaring the decorators functions
- `<namespace>.ts-test.ts`: Contains some test using typescript type
system to make sure the package does reexport the right `$<name>` for
each decorator

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-03-19 23:08:59 +00:00
Timothee Guerin 743c4b0a39
Fix another set of accessibility issues (#3031) 2024-03-19 18:57:02 +00:00
Timothee Guerin 4199f83575
Upgrade dependencies march 2024 (#3027)
General update of all dependencies, notable
- typescript 5.4
- vitest 1.4
2024-03-18 10:52:06 -07:00
Timothee Guerin 6d42ca6e65
Deprecate projected name (#2910)
fix [#2832](https://github.com/microsoft/typespec/issues/2832)
2024-03-13 12:48:07 -07:00
Timothee Guerin 00996bbe30
Don't prevent going to next stage when a warning is elevated to an error (#2983)
fix #2972
2024-03-12 22:14:42 +00:00
Timothee Guerin 128a508c25
Allow encode on a union (#2992)
fix [#2969](https://github.com/microsoft/typespec/issues/2969)
2024-03-12 14:49:17 -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 6d5fb9c047
Bump chronus github with fix to not crash on existing release (#2995) 2024-03-06 19:48:53 +00:00
Timothee Guerin 7312314bcb
Remove old message burried in changelog (#2989) 2024-03-05 16:05:57 -08:00
Timothee Guerin 9881002f1c
Bump versions for release march 2024 (#2988) 2024-03-05 15:31:47 -08:00
iscai-msft 4cafd969de
Add json schema test library (#2987) 2024-03-05 22:14:58 +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
Timothee Guerin de6bd7bc30
Go to import (#2978)
fix #1294
![Kapture 2024-03-01 at 14 41
07](https://github.com/microsoft/typespec/assets/1031227/8be68f83-4eca-421c-b6dd-27bc1eed141f)
2024-03-04 15:15:19 -08:00
Timothee Guerin 82fab0a5e6
Fix: Authentication on containing namespace (#2980)
fix #2979

Authentication wasn't resolving values set on the namespaces.
2024-03-04 10:55:35 -08:00
Timothee Guerin 01ba99b061
Fix dup doc (#2976)
Before
<img width="465" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/b620cac2-b70a-4a99-a784-bf03d55bd28b">

Now
<img width="413" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/d2a0b293-7924-44e7-9e1c-036ff40f1b6d">
2024-03-01 20:50:11 +00:00
Timothee Guerin 8c7c76bf8e
`isErrorModel` check for base models (#2968)
fix #2957
2024-03-01 01:59:52 +00: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 717af6421f
Deprecate `@service` version and allow `@OpenAPI.info` to take all properties allowed by openapi (#2902)
fix [#2821](https://github.com/microsoft/typespec/issues/2821)

## Deprecate `@service({version`

Using this property will emit a deprecation warning

## Cover everything with `@OpenAPI.info`

Makes sure all the properties allowed on the `info` object of openapi
specification can also be provided in `@info`. The properties will
either override other ways of specifying those previously or be the only
way.
- `@info({description` would override `@doc` on service namespace
- `@info({summary` would override `@summary` on service namespace
- `@info({title` would override `@service({title}` on service namespace
2024-02-28 22:56:09 +00:00
Timothee Guerin 9d8cfb016e
Fix don't emit shared route error when verb don't match (#2948)
fix [#2925](https://github.com/microsoft/typespec/issues/2925)

Stop emitting the error if there is a shared route and a non shared
route on a different verb.

Also improve the error: 
- change message to be a little more clear
- emit the error on every offending operation not just the first one we
find an duplicate

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-02-28 22:17:46 +00:00
Timothee Guerin c9c1f3e442
Validate `@useAuth` is unique on node (#2958)
fix #2787 

having multiple has no effect, the latest value will override the
previous ones so there is no reason to use `@useAuth` twice on the same
node

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-02-28 21:52:19 +00:00
Timothee Guerin f884772255
Fix: File with only comment and one on the first line reorder comments (#2955)
fix #2508
2024-02-28 21:24:07 +00: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
Timothee Guerin 628517e0c2
Remove prettier2.0 support in prettier plugin (#2956)
fix #2760 
`@typespec/prettier-plugin-typespec` dropped support for prettier 2.0.
Update to 3.0 to use the new version of the plugin.
2024-02-28 11:17:30 -08:00
Timothee Guerin 66c2df18e2
Do not run decorators that have missing args (#2959)
fix [#3940](https://github.com/Azure/typespec-azure-pr/issues/3940)
2024-02-27 11:04:00 -08: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
Brian Terlson aa6e53f4ab
Add `getOpenAPI3` to OpenAPI3 emitter (#2950)
This function is useful when you want to work with the OpenAPI 3
directly, or don't want to write it to disk for some reason.

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-02-26 22:44:26 +00:00
Timothee Guerin 15702e82f4
Move compiler utils to `/utils` exports (#2919)
Provide a new exports `/utils` where we can export utils that are
commonly used in libraries and emitters but not tied to typespec
directly(deepClone, deepEquals, etc.)
2024-02-23 17:48:19 +00:00
Timothee Guerin 753ca1ad9b
Improvement to the import auto complete (#2936)
- fix #2481 Autocomplete directive names
- Stop crashing when completing invalid dir
- Autocompleting dir with non letter char (e.g. `-`) will autocomplete
correctly
- Playground autocomplete imports
<img width="579" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/08e9e516-6472-4ab2-b3a5-30b4a8ce722d">
2024-02-20 13:49:56 -08:00
Ikko Eltociear Ashimine b4b0bbbc9d
Update file-templating.ts (#2847)
langauges -> languages

---------

Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Co-authored-by: Allen Zhang <allenzhang@live.com>
2024-02-20 21:01:01 +00:00
Timothee Guerin 09aae4cbd1
Report error when having a circular template constraint (#2932)
fix [#2788](https://github.com/microsoft/typespec/issues/2788)
2024-02-20 20:37:29 +00:00
Timothee Guerin d53b30dbfa
Add `Scalar` to TS `TemplatedType` type (#2929)
fix [#2763](https://github.com/microsoft/typespec/issues/2763)
2024-02-20 20:05:54 +00:00
Timothee Guerin 79745d1cc8
Fix: Program Viewer crash when using unnamed union variants (#2941) 2024-02-20 08:46:40 -08:00
Timothee Guerin 2d6e138ac1
Fix crash with deleted file (#2934)
fix #2928
2024-02-16 19:00:44 -08:00
Timothee Guerin 69e93a8310
Fix: Bumping prerelease count changes from chronus (#2918) 2024-02-14 15:40:39 -08:00
Timothee Guerin 4879eea2e3
Fix pr artifacts deps versions (#2914)
Since we moved to `workspace:~` instead of `workspace:~x.y.z` for
dependency when building pr artifact it is repalced with the actual
version which in pr case is `x.y.z-pr.{prnumber}.{buildid}` and this
cause installation conflict
2024-02-13 23:52:20 +00:00
Timothee Guerin 639d8992c8
Add e2e test for the CLI (#2878)
fix #489

e2e test were also not running at all and the `emitter-ts` template was
failing due to importing `vitest` instead of `node:test`
2024-02-09 16:41:52 +00:00
Timothee Guerin afd377242e
Include tmlanguage computed file in repo as we'll need it for github linguist (#2872)
To register a tm language on github linguist we need to publish our
grammar.
Instructions
https://github.com/github-linguist/linguist/blob/master/CONTRIBUTING.md#adding-a-language
2024-02-09 04:07:46 +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 71fa909634
Fix: No colors when using `--watch` (#2886)
fix  #2591
2024-02-09 01:12:48 +00:00
Timothee Guerin a1eb851cc3
Enable spell check for all files and fix (#2881)
fix #2776
2024-02-08 16:54:23 -08: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