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

333 Коммитов

Автор SHA1 Сообщение Дата
Jose Manuel Heredia Hidalgo afd894565d
Propagate Namespace mutation to its types (#4937)
- Expose mutateSubgraphWithNamespace which allows Namespace mutations
- mutateSubgraph doesn't allow Namespace mutators. We want to keep
namespace mutator hidden as it is a more advanced use case.
2024-11-06 02:17:17 +00:00
Timothee Guerin 7aa6b682a6
Bump version for 0.62.0 release (#4980) 2024-11-05 21:33:01 +00:00
Timothee Guerin 63a0784d04
Add TypeSpec 0.62 release notes (#4977)
Co-authored-by: Christopher Radek <14189820+chrisradek@users.noreply.github.com>
2024-11-05 19:20:28 +00:00
Kyle Zhang 314b337154
Fix issue for xml-model (#4970)
missing items ` - {}` in Author

```
model Book {
  author: Author[];
}

model Author {
  @attribute id: string;
  book?: Book[];
}
```

```
Author:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          xml:
            attribute: true
        book:
          type: array
          items:
            allOf:
              - {}
            xml:
              name: Book
          xml:
            wrapped: true
    Book:
      type: object
      required:
        - author
      properties:
        author:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/Author'
            xml:
              name: Author
          xml:
            wrapped: true
```

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-11-05 17:06:15 +00:00
Timothee Guerin 78140e410d
Add paging support (#4470)
close https://github.com/microsoft/typespec/issues/705

---------

Co-authored-by: iscai-msft <43154838+iscai-msft@users.noreply.github.com>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2024-11-05 01:47:23 +00:00
Timothee Guerin b39abe5e63
Symbol refactor (#4849)
### Augment decorator issues
Fix https://github.com/microsoft/typespec/issues/4749 Augment/ref alias
properties
Fix https://github.com/microsoft/typespec/issues/2867 Augment/ref `model
is` properties
Fix https://github.com/microsoft/typespec/issues/4818 Augment/ref nested
model properties

### Circular reference issues
Fix https://github.com/microsoft/typespec/issues/4908 freeze when using
circular model extends with aliases

### Others
FIx https://github.com/microsoft/typespec/issues/4915 (Duplicate usings
not scoped per namespace)

Doesn't resolve the alias circular issue
https://github.com/microsoft/typespec/issues/2824 but I think setup the
solution for fixing it later in the name resolver where we could detect
that cycle instead of the checker

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-11-04 23:50:10 +00:00
Timothee Guerin 2d7eecff6d
Diagnostic path log relative to current working dir (#4807)
To improve #4806 need to cleanup the path resolution

close https://github.com/microsoft/typespec/issues/2274

### Before


![image](https://github.com/user-attachments/assets/fe2832ed-b794-4c80-b25a-157aeae3bd07)


### After
- From parent folder

![image](https://github.com/user-attachments/assets/e210fd50-e154-4e34-8129-3e6eae8a6018)

- From same folder

![image](https://github.com/user-attachments/assets/fb47894b-70df-4857-9a5f-451c9ece5355)
2024-11-04 22:13:22 +00:00
Timothee Guerin bd664ec553
Collect template instantiation stack (#4806)
#1317

## CLI

![image](https://github.com/user-attachments/assets/de8e30bf-cba8-4908-b687-2c6ce5a93d1b)


## IDE

Error at the original location
<img width="1187" alt="image"
src="https://github.com/user-attachments/assets/02d0b2df-65f7-4c43-b60d-8fab3b569046">

Error at the template instantitiation
<img width="988" alt="image"
src="https://github.com/user-attachments/assets/06785dce-de85-4b1a-842f-fda0a6f87f1a">
2024-11-04 21:06:04 +00:00
Kyle Zhang f03556b57f
Add new `@tagMetadata` decorator to OpenAPI library (#4834)
fix https://github.com/microsoft/typespec/issues/2220

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-11-04 17:04:00 +00:00
Dapeng Zhang 7710c4d7eb
fix a doc issue for `opExample` (#4773)
It should be `@opExample` instead of `@example`.
2024-11-04 07:16:41 +00:00
James Chen b47d0398c8
Typespec Generation for Empty Schema #4923 (#4934)
fix #4923

---------

Co-authored-by: Christopher Radek <14189820+chrisradek@users.noreply.github.com>
2024-11-01 21:16:03 +00:00
subaru 220769ed1c
[http] Add Parameter Decorator `@cookie` to Specify Cookie Parameters (#4761)
close #4739 

- `@typespec/http`
  - add `@cookie` decorator to decorate parameters as cookie parameters
  - add `response-cookie-not-supported` diagnostics
    - to be emitted when response cookies are specified
  - add tests for cookie params
- `@typespec/http-server-javascript`
  - throw UnimplementedError when cookie params came
- `@typespec/openapi3`
  - support cookie param case
  - add tests for cookie params
  
### response cookie design

| in | explicit body | implicit body |
| - | - | - |
| diagnostics | `metadata-ignored` | `response-cookie-not-supported` |
| result | included (unified with other metadata) | NOT included
(prevent breaking change for `set-cookie`) |

---

based on:
- https://github.com/microsoft/typespec/discussions/4721

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2024-11-01 19:59:32 +00:00
Timothee Guerin 67a0680123
Move docs under astro (#4928)
Current setup makes it very hard to iterate and see output in website as
you have to always `pnpm copy` after a change

last item for https://github.com/microsoft/typespec/issues/2564
2024-10-31 20:10:29 +00:00
Timothee Guerin 151be7fa46
Use allof when building nullable enum (#4727)
fix [#4398](https://github.com/microsoft/typespec/issues/4398)
2024-10-31 19:22:57 +00:00
Christopher Radek 012ec81788
tsp-openapi3 - fixes query decorator arg generation (#4873)
Fixes #4298 

Added tests for all the OpenAPI permutations of query params
explode/style. This also updates tsp generation to be compatible with
the change introduced in `@typespec/http` v0.59.1 where `@query` without
params sets `explode: false` (previously it was not set - which assumed
`explode: true`.)

---------

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
2024-10-31 19:19:30 +00:00
Timothee Guerin b8462a07b7
generated uri template include explode * for query params (#4932)
fix https://github.com/microsoft/typespec/issues/4881
2024-10-31 19:15:24 +00:00
Sarangan Rajamanickam 69cc41211b
[@typespec/spector] [@typespec/spec-coverage-sdk] - Handle Upload Scenario Manifest (#4920)
Earlier, in the `upload-scenario-manifest` script, I had handled the
multiple paths in a different way (one by one). After working with the
`cadl-ranch-dashboard`, the correct approach is to generate the manifest
file in the same way as coverage file. This PR performs this task.

Here is a snapshot of the modified manifest file:


![image](https://github.com/user-attachments/assets/cf752245-452a-424f-b1ed-86b2965103a0)

Please review and approve the PR. Thanks
2024-10-31 17:39:41 +00:00
Rodge Fu 81c83ddbba
Restart Typespec Language Server when it's not started before or settings changed (#4912)
1. TypeSpec Language Server would be restarted with new settings when
setting "typespec.tsp-server.path" is changed
2. Typespec Language Server can be restarted properly when the server
wasn't running before
3. Code refactor in vscode extension.

related issues:
#2996, #4765

---------

Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2024-10-31 15:27:23 +00:00
Christopher Radek d768220122
tsp-openapi3 - support generating summary decorator (#4906)
Fixes #4489 and fixes #4614

This now generates the `@summary` decorator based on either the
Component schema `title` field, or the path item `summary` field.

---------

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-10-30 15:36:52 +00:00
Rodge Fu 5cfd7d08fb
Support completion for tspconfig.yaml file in vscode (#4790)
Support completion for tspconfig.yaml file in vscode

#2049
2024-10-30 14:37:10 +00:00
Kyle Zhang 2f896c7703
The description parameter of @server should be optional (#4804)
https://github.com/microsoft/typespec/issues/2229

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-10-29 23:50:04 +00:00
Sarangan Rajamanickam a4bab8127f
[@typespec/http-specs] Fix test script (#4902)
Related to https://github.com/Azure/typespec-azure/pull/1753 , I am
fixing the test script. Refer
https://github.com/Azure/typespec-azure/pull/1753#discussion_r1821316750
for more details.

Please review and approve the PR. Thanks
2024-10-29 21:06:27 +00:00
Jose Manuel Heredia Hidalgo 90e87534f9
Allow mutating namespaces (#4871)
Allow mutateSubgraph on a Namespace type

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-10-28 16:13:46 +00:00
Kyle Zhang f5ceafda4f
Add xml support to openapi3 (#4214)
1. add test cases based on
[Examples](https://tspwebsitepr.z22.web.core.windows.net/prs/2982/docs/next/release-notes/xml-support.html#examples)
2. add xml in OpenAPI3Schema type
3. update schema-emitter logic for support xml object

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Co-authored-by: Wanpeng Li <wanl@microsoft.com>
2024-10-28 16:02:22 +00:00
Sarangan Rajamanickam 265c4fcdae
[@typespec/spector] - Handle and report failed scenarios at the end (#4872)
In the `server-test` scenario, if there is an error, then the script
immediately reports the error and comes out of the execution. But, the
service generator has not implemented all the scenarios yet. So, If all
the scenarios are executed, then the script might fail even before
executing the intended script. So, the correct approach would be to
report at the end.

Please review and approve the PR. Thanks
2024-10-26 01:37:27 +00:00
Sarangan Rajamanickam b8d49729a7
[@typespec/spector] - Enable Multiple Scenario Paths (#4836)
Currently we could execute the `serve`/`server-test`/... command such
as:

`pnpm .\cmd\cli.mjs serve ..\http-specs\specs`

i.e we could provide only one path of scenarios to execute. But, since
we separated the scenarios to azure and non-azure specific cases to 2
different packages, we need a way to execute commands such as:

`pnpm .\cmd\cli.mjs serve ..\http-specs\specs
..\..\..\typespec-azure\packages\azure-http-specs\specs\`

The same procedure must be followed in all other commands such as
`validate-scenarios`, `generate-scenarios-summary`, etc. Since we have
to do it for all the commands and we need to change in all the places,
it is much simpler to do it in one location where we copy the files to
one common temp location and execute from there.

Also, in this PR, I have removed the `private: true` option for all the
5 packages to start the rollout process.

Please review and approve the PR. Thanks
2024-10-25 17:06:57 +00:00
Mingzhe Huang ca2d3016e9
[vs-code-extension] add basic snippets for typespec (#4737)
- add snippets for typespec basic constructs
- package snippets within vs code extension

part of #4559
2024-10-23 04:02:29 +00:00
Timothee Guerin f3788f1df7
Fix float32/float64 docs (#4779)
fix #4748
2024-10-17 20:34:26 +00:00
Timothee Guerin 115d15592e
Improve diagnostics when fails to load js (#4745)
fix [#4582](https://github.com/microsoft/typespec/issues/4582)

Also fix allow resolving `import` as a named condition for emitters
2024-10-15 19:50:28 +00:00
Timothee Guerin e9a65ca53d
Configure api extractor for json schema and add docs and refactor (#4732)
Configure api extractor and add docs. Additionally refactored to use
some newer pattern of decorator declaration.
2024-10-15 19:12:26 +00:00
Christopher Radek cec2b389c8
adds packages to chronus versioning config (#4730)
Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
2024-10-14 21:59:00 +00:00
Alitzel Mendez de763ceb0f
Mark discriminator properties consistently as requiered (#4663)
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2024-10-14 21:12:29 +00:00
Christopher Radek 6c6f3116ef
tsp-openapi3: support path-level parameters (#4708)
Fixes #4455 

Previously, the parameters defined as a child of a `path` were ignored.
Now they are added to the operations defined in each of the path's
methods.

The spec states that duplicates are not allowed in the final
operation-level parameter list, and the more specific (operation level)
replaces the less specific (path level) if there is a collision. A
combination of the location and name uniquely identify a parameter for
these purposes.

Example:
```yml
openapi: 3.0.0
info:
  title: (title)
  version: 0.0.0
tags: []
paths:
  /widgets/{id}:
    get:
      operationId: Widgets_read
      responses:
        "200":
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Widget"
    delete:
      operationId: Widgets_delete
      responses:
        "204":
          description: "There is no content to send for this request, but the headers may be useful. "
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
components:
  schemas:
    Widget:
      type: object
      required:
        - id
      properties:
        id:
          type: string

```

---------

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
2024-10-14 17:55:53 +00:00
Timothee Guerin da9a31f2b2
Fix editor dark theme (#4719) 2024-10-14 16:34:06 +00:00
Timothee Guerin eeee93e5d3
TSPD exports support (#4700) 2024-10-11 21:13:24 +00:00
Kyle Zhang 3660144b4e
Fix OpenAPI3 type property should always be set when nullable property is present (#4672)
https://github.com/microsoft/typespec/issues/4584

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
2024-10-11 15:20:32 +00:00
Timothee Guerin 0c3cd362f5
Migrate website to astro [Step 1] (#4587)
Progress for #2564 
Changes: 
- Decided to cut versioning for now. Starlight doesn't support well now
and would be a decent amount of work. Our doc have been quite stable and
this slows down the build significantly.\


The plan is as follow
1. Merge this as a parallel build to the docusaurus website
2. Add blog back
3. Cleanup things (like migrate more things out of fluentui react
components)
4. Switch the website to use this one
5. If we are happy delete docusaurus
2024-10-11 01:38:03 +00:00
Timothee Guerin 12c67ef552
Upgrade dependencies - October 2024 (#4679) 2024-10-10 16:54:34 +00:00
Timothee Guerin 29c0082df3
Bump version for release 0.61.0 (#4661) 2024-10-09 21:27:28 +00:00
Timothee Guerin 767ee82916
Fix virtual path playground (#4656)
Only changed the entrypoint also needed for the output path
2024-10-09 18:25:58 +00:00
Timothee Guerin c479dac8a9
Add release notes for 0.61 release (#4654) 2024-10-09 17:28:08 +00:00
Swati Kumar 010ebded10
Add missing exit callbacks (#4626)
Fixes: https://github.com/microsoft/typespec/issues/4588

This won't call the post order exit callbacks if recursion stops at
pre-order callbacks.

---------

Co-authored-by: swatikumar <swatikumar@pinterest.com>
2024-10-09 15:07:30 +00:00
Christopher Radek f69f8faf7a
Add support for defining streams (#4513)
Related: https://github.com/microsoft/typespec/issues/154

---------

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
2024-10-07 23:22:48 +00:00
Timothee Guerin aaae51a69f
Project source models (#4445)
fix [#4280](https://github.com/microsoft/typespec/issues/4280)

---------

Co-authored-by: Christopher Radek <14189820+chrisradek@users.noreply.github.com>
2024-10-07 17:40:32 +00:00
Timothee Guerin aa189c65b5
Update decorator arg marshalling to new default (#4500)
fix [#4138](https://github.com/microsoft/typespec/issues/4138)
2024-10-05 03:37:12 +00:00
Timothee Guerin 77edf34508
Add support for named exports (#4606)
fix https://github.com/microsoft/typespec/issues/4562

---------

Co-authored-by: Christopher Radek <cradek@microsoft.com>
2024-10-04 23:05:04 +00:00
Timothee Guerin b3dbbfd40b
Check that e2e snapshot files are up to date (#4610) 2024-10-04 22:23:14 +00:00
Timothee Guerin e80bdce699
Fix: Passing `const` of model type to `@example` (#4574)
fix #4544
2024-10-04 20:29:36 +00:00
Timothee Guerin 68c94a715b
Add url property to diagnostic (#4442)
fix [#4142](https://github.com/microsoft/typespec/issues/4142)
Every diagnostic can now define a url pointing to a documentation with
more information on how you might have this diagnostic and how to
resolve it
2024-10-04 20:20:12 +00:00
Timothee Guerin 7c425cdb08
Fix enum in union example (#4462)
fix #4416
2024-10-04 19:40:08 +00:00