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

2504 Коммитов

Автор SHA1 Сообщение Дата
Dapeng Zhang 3aa2f5c373
fix the response does not deserialize issue (#4029)
This PR fixes the responses in operation not deserializing issue, but
uncovers another bug about how the convenience methods are implemented.

---------

Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
2024-07-26 17:12:38 +00:00
JoshLove-msft f931701386
Add PostVisit method (#4026)
Fixes https://github.com/microsoft/typespec/issues/4016
2024-07-26 01:09:56 +00:00
m-nash e746179f66
Cadl ranch test framework (#3964)
Fixes https://github.com/microsoft/typespec/issues/3938
Fixes https://github.com/microsoft/typespec/issues/3337

- Will update coverage tracking for cadl ranch in this follow up issue
https://github.com/microsoft/typespec/issues/4012
- RestClient file is empty which will be addressed in this follow up
issue https://github.com/microsoft/typespec/issues/4016
2024-07-25 21:27:15 +00:00
m-nash 2fdb218b69
exclude when cspell.yaml changed (#4021)
Don't trigger try it if only cspell.yaml was changed outside of emitters
2024-07-25 20:55:37 +00:00
dependabot[bot] 5f41741ef3
Bump braces from 3.0.2 to 3.0.3 in /packages/http-client-csharp (#3606)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to
3.0.3.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="74b2db2938"><code>74b2db2</code></a>
3.0.3</li>
<li><a
href="88f1429a0f"><code>88f1429</code></a>
update eslint. lint, fix unit tests.</li>
<li><a
href="415d660c30"><code>415d660</code></a>
Snyk js braces 6838727 (<a
href="https://redirect.github.com/micromatch/braces/issues/40">#40</a>)</li>
<li><a
href="190510f79d"><code>190510f</code></a>
fix tests, skip 1 test in test/braces.expand</li>
<li><a
href="716eb9f12d"><code>716eb9f</code></a>
readme bump</li>
<li><a
href="a5851e57f4"><code>a5851e5</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/braces/issues/37">#37</a>
from coderaiser/fix/vulnerability</li>
<li><a
href="2092bd1fb1"><code>2092bd1</code></a>
feature: braces: add maxSymbols (<a
href="https://github.com/micromatch/braces/issues/">https://github.com/micromatch/braces/issues/</a>...</li>
<li><a
href="9f5b4cf473"><code>9f5b4cf</code></a>
fix: vulnerability (<a
href="https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727">https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727</a>)</li>
<li><a
href="98414f9f1f"><code>98414f9</code></a>
remove funding file</li>
<li><a
href="665ab5d561"><code>665ab5d</code></a>
update keepEscaping doc (<a
href="https://redirect.github.com/micromatch/braces/issues/27">#27</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/micromatch/braces/compare/3.0.2...3.0.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=braces&package-manager=npm_and_yarn&previous-version=3.0.2&new-version=3.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/microsoft/typespec/network/alerts).

</details>

> **Note**
> Automatic rebases have been disabled on this pull request as it has
been open for over 30 days.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-25 16:49:03 +00:00
Timothee Guerin 3087671788
Add java emitter label (#3963) 2024-07-25 15:40:29 +00:00
Dapeng Zhang 9f5630b430
fix the input type deserialization issue (#4011)
Contributes to https://github.com/microsoft/typespec/issues/3938

In `autorest.csharp` we do not have a `InputNamespace` converter - but
we have one here, and we are asserting the auth to never be null, but it
is not true, some project does not define their auth.
2024-07-25 05:10:25 +00:00
Dapeng Zhang f848c5efdd
Use the `UsageFlags` from TCGC directly in our emitter (#3842)
Fixes https://github.com/Azure/autorest.csharp/issues/4820
Fixes https://github.com/Azure/autorest.csharp/issues/4734

This PR changes our the converter logic in our emitter, so that we do
not need to convert the usage flags from TCGC to ours, we directly use
their result. As part of the motivation, a few workaround logic to "fix"
the usages has been removed.
2024-07-25 05:09:14 +00:00
JoshLove-msft 745b4f9722
Add visitor tests (#3961)
Fixes https://github.com/microsoft/typespec/issues/3813

- Adds tests for OutputLibraryVisitor
- Renames the Mocks folder to TestHelpers
- Adds protected ctors and unseals several types for mocking
- Visits constructors in OutLibraryVisitor
- Updates TypeProvider.Update to take IEnumerable instead of List
2024-07-24 22:40:52 +00:00
Timothee Guerin 6df2990357
Update docs for `@server` (#3960) 2024-07-24 22:37:20 +00:00
Timothee Guerin 24ce91157a
Fix version for js server emitter (#3959) 2024-07-24 17:55:00 +00:00
Timothee Guerin 54c6d88956
Update storage blob with content length bug fix (#3957)
https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/CHANGELOG.md#12240-2024-07-18
2024-07-24 16:55:33 +00:00
Timothee Guerin 39a95b9ddc
Store what would have been cookies in memory instead so the field is still sent (#3956) 2024-07-24 16:31:20 +00:00
Timothee Guerin 6be508b1b5
Website scripts do not load when loading a deep page (#3952)
problem is they are relative so it fails
2024-07-24 16:29:05 +00:00
Timothee Guerin 10488deafe
Allow spreading a model that has props added in previous version (#3911)
fix [#3639](https://github.com/microsoft/typespec/issues/3639)

Allow this scenario

```

model Base {
  @added(Versions.v1) name: string;
}

@added(Versions.v2)
model Child {
  ...Base;
}

```
2024-07-23 22:49:26 +00:00
Christopher Radek 755df7472e
versioning - fixes crash when spreading incompatible versioned model as parameter to operation (#3951)
Fixes #3648

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
2024-07-23 22:39:28 +00:00
Jorge Rangel 29145430be
Add client ctor generation support (#3849)
This PR adds support for generating the constructors for a client.

fixes: https://github.com/microsoft/typespec/issues/3661
2024-07-23 21:54:18 +00:00
Greg Poirier 39d4c60da5
[docs/libraries/http] Fix incorrect reference to @header annotation in statusCode documentation. (#3949)
I believe this mistakenly says to use the `@header` annotation on a
property and should say `@statusCode`.
2024-07-23 21:05:25 +00:00
Timothee Guerin 49004b60d5
Update dependencies (#3948)
New pr from this branch as it had some weird docusaurus issue not
reproducable anywhere else and just changing branch fixes it somehow
https://github.com/microsoft/typespec/pull/3934
Notable:
- vitest: 2.x
- prettier update that does a minor formatting change by adding
parentheses in some ternary expression
2024-07-23 21:02:34 +00:00
m-nash 41c031264b
Add CreateRequest methods (#3937)
Fixes https://github.com/microsoft/typespec/issues/3679
Fixes https://github.com/microsoft/typespec/issues/3826
2024-07-23 19:21:36 +00:00
Rodge Fu 96c81c5c33
Support completion for template parameter extending model or object value (#3906)
fix #3778

---------

Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2024-07-23 00:58:04 +00:00
Timothee Guerin 6aad4a795f
Add `const` template parameter to get the precise lib type (#3933)
Without that there is some loss of information
2024-07-22 22:25:40 +00:00
Timothee Guerin 50a8ba2ad7
Fix valueof reflection types (#3929)
Arm library had a `valueof string | EnumMember` where this tried to
generated an interface called `EnumMember` instead of pointing to
`EnumValue`
2024-07-22 16:18:32 +00:00
Christopher Radek d8a476032b
openapi3 - fix bug where union-level docs were applied to members (#3912)
Fixes regression introduced in #3908 where docs set at the union level
were being applied to each union variant.

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
2024-07-19 20:56:43 +00:00
ShivangiReja c0f58d398a
Implement Client Properties Generation Support (#3910)
Fixes: https://github.com/microsoft/typespec/issues/3662

---------

Co-authored-by: ShivangiReja <shivangi.reja@microsoft.com>
2024-07-19 20:25:22 +00:00
Christopher Radek c4aa1abe17
openapi3 - fixes bug with circular references in unions (#3908)
Fixes #3811 

Root cause seemed to be that when encountering 2+ non-null items in a
union, placeholders weren't getting wrapped by ObjectBuilder and thus
the emitter wasn't resolving circular references correctly.

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
2024-07-19 17:54:12 +00:00
JoshLove-msft 998440879a
Add AddVisitor method and Configure hook (#3897)
Fixes https://github.com/microsoft/typespec/issues/3827

Also adds a Configure hook so that AddVisitor can be called directly
from the Plugin. Considered just using the ctor but that would mean we
would have virtual property calls in a ctor.
2024-07-19 17:43:49 +00:00
Timothee Guerin 2c16b4b089
Tspd generate interface for valueof models used in decorators (#3902)
progress toward #3303

Add type generation for model used as valueof
2024-07-19 16:33:45 +00:00
Timothee Guerin d52f9f441d
Generate documentation for enum members (#3878)
fix https://github.com/microsoft/typespec/issues/3436
2024-07-19 16:33:35 +00:00
m-nash 750612886e
Add method parsing for INamedTypeSymbol (#3896)
Fixes https://github.com/microsoft/typespec/issues/3805
2024-07-19 15:06:13 +00:00
Timothee Guerin 0151b90221
Fix decimal numeric with leading zeros (#3898)
fix #3888
2024-07-18 21:54:30 +00:00
Sarangan Rajamanickam 45bec8e214
[@typespec/openapi3] Add $ref to Response Object (#3894)
Per the requirement in [Issue
3601](https://github.com/microsoft/typespec/issues/3601), the 'useRef'
plugin must be respected and used correctly. This PR does that.

**Before Changes**

![image](https://github.com/user-attachments/assets/be4bdeb3-4c1e-4f4a-a1ed-75abfee3f98c)

**After Changes**

![image](https://github.com/user-attachments/assets/55978f2b-25d4-4e85-91a1-4b313ade62de)

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-07-18 18:23:44 +00:00
Maggie Kimani 8d8e454358
Attach namespace extensions to the root of the doc (#3890)
This PR seeks to update the emitter by adding the extensions defined on
a namespace to the root of the OpenApi document.
Fixes #3837

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-07-18 17:20:07 +00:00
Christopher Radek 61807aa693
fixes bug rendering backslashes when present as last character in doc comment line (#3881)
Fixes #3646

Updated `scanDoc` to only update the escaped flag when a backslash
precedes `@`. This is the only character we currently unescape later on
in this scenario currently.

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
2024-07-18 17:03:28 +00:00
Pan Shao ac44dc397a
Add fluent style to NullConditionalExpression (#3800)
Fix #3798, Fix #3829

---------

Co-authored-by: Pan Shao <pashao@microsoft.com>
Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
2024-07-18 16:42:38 +00:00
Crystal YU 1f238bfee7
upgrade typespec to 0.58.0 (#3869)
upgrade typespec to 0.58.0
2024-07-18 06:48:31 +00:00
Dapeng Zhang 81b1692e52
Fix the base type issue of models (#3730)
Fixes #3729
Fixes https://github.com/microsoft/typespec/issues/3741

---------

Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
2024-07-17 20:40:00 +00:00
Timothee Guerin 20e6e59a33
Add new label for openapi converter and ui (#3877) 2024-07-17 20:25:10 +00:00
Mario Guerra d705dd53b4
minor edits and corrections (#3841) 2024-07-17 17:25:51 +00:00
Timothee Guerin 66e89be478
Bump version for compiler hotfix release 0.58.1 (#3876) 2024-07-17 17:08:08 +00:00
Timothee Guerin 8cd4ed00bf
Fix issues with examples (#3875)
fix #3874 (Examples not working with nested model in array)
fix #3872 (Examples not working when type is union)

Additionally found the following issues that this fix:
- not working when type was `unknown`
- not working with `Record`
2024-07-17 16:13:05 +00:00
Crystal YU fbb3d19479
switch to release MGC in public feed (#3843)
Switch to release MCG to public feed.

Current MCG emitter is published into a internal feed. Now MCG will be
used as plugin in autorest.csharp emitter, MCG emitter needed to be
installed when run autorest.csharp emitter, so we need to publish MCG to
a public feed.
Fix https://github.com/microsoft/typespec/issues/3861
Move `readme.md` to package top-level directory so that readme can show
in npm.
2024-07-17 05:02:30 +00:00
m-nash 68e1c38598
Remove GetTypeProvider (#3860)
Supports https://github.com/microsoft/typespec/issues/3805
2024-07-17 01:42:20 +00:00
JoshLove-msft 67655d794a
Clean up try/catch/finally API (#3859)
Contributes to https://github.com/microsoft/typespec/issues/3825

Change CatchExpression to be CatchStatement since it is really a
statement.
Make each of Try/Catch/Finally statements implement
`IEnumerable<MethodBodyStatement>`. This is consistent with
IfStatement/ForStatement,etc and it allows for writing generator code
with structure that mirrors what the generated code will look like
(apart from having comma delimiters as opposed to semicolons) e.g.

```c#
new TryStatement
{
 statement1,
 statement2
}
```
Generates

```c#
try
{
...
...
}
```
2024-07-17 01:34:13 +00:00
Dapeng Zhang 6a3bbf6ad3
reenable the property initialization type tests (#3846)
When I run the test cases in the other PR, I happened to notice that
these tests are disabled.
Since we already get those ApiTypes refactored for a few weeks, we
should reenable them.
2024-07-17 00:16:36 +00:00
Timothee Guerin af65ce9220
Bump versions for release 0.57 (#3855) 2024-07-17 00:10:54 +00:00
JoshLove-msft 90527d9f2d
Sample plugin cleanup (#3857) 2024-07-17 00:08:12 +00:00
JoshLove-msft 9c282369f9
Allow same CodeWriterDeclaration to be written twice (#3854)
This came up when testing out the plugin extensibility where a visitor
would write out a method body statement. The code declaration would be
declared twice - once when actually writing the library, and the second
time when writing the method body statement from the visitor.
2024-07-16 23:44:29 +00:00
Timothee Guerin 27ed13de58
Revert "Add validator to prevent discriminator and encodedname used together" (#3852)
Reverts microsoft/typespec#3763

This is actually a pattern used for things like `@odata.kind` and would
need more discussion to disallow
2024-07-16 21:35:49 +00:00
Timothee Guerin 0442e27399
Add release notes for 0.58 (#3851)
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-07-16 20:21:54 +00:00