Skip to content

Commit

Permalink
Add CONTRIBUTING guide, fix Add-Customizations.ps1 script (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseharriaga authored Feb 29, 2024
1 parent d01aefa commit 6604f76
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
16 changes: 16 additions & 0 deletions .dotnet/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CONTRIBUTING

## How to run code generation

1. Run the following command to install the necessary tools:
`npm install`
1. Regenerate the OpenAPI spec by running the following command:
`npx tsp compile .\openai-in-typespec\main.tsp --emit @typespec/openapi3`
1. Regenerate the library by running the following command:
`npx tsp compile .\openai-in-typespec\main.tsp --emit @azure-tools/typespec-csharp --option @azure-tools/typespec-csharp.emitter-output-dir=.\openai-in-typespec\.dotnet`
1. Run the following script:
`.\openai-in-typespec\.dotnet\scripts\Update-ClientModel.ps1`
1. Run the following script:
`.\openai-in-typespec\.dotnet\scripts\ConvertTo-Internal.ps1`
1. Run the following script:
`.\openai-in-typespec\.dotnet\scripts\Add-Customizations.ps1`
5 changes: 0 additions & 5 deletions .dotnet/Directory.Build.props

This file was deleted.

13 changes: 12 additions & 1 deletion .dotnet/scripts/Add-Customizations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,16 @@ function Update-MicrosoftBclAsyncInterfacesPackage {
Set-Location -Path $current
}

function Set-LangVersionToLatest {
$root = Split-Path $PSScriptRoot -Parent
$filePath = Join-Path -Path $root -ChildPath "tests\OpenAI.Tests.csproj"
$xml = [xml](Get-Content -Path $filePath)
$element = $xml.CreateElement("LangVersion")
$element.InnerText = "latest"
$xml.Project.PropertyGroup.AppendChild($element) | Out-Null
$xml.Save($filePath)
}

Update-SystemTextJsonPackage
Update-MicrosoftBclAsyncInterfacesPackage
Update-MicrosoftBclAsyncInterfacesPackage
Set-LangVersionToLatest
5 changes: 2 additions & 3 deletions .dotnet/tests/OpenAI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
<TargetFramework>net7.0</TargetFramework>
<!--Ignore XML doc comments on test types and members-->
<NoWarn>$(NoWarn);CS1591</NoWarn>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\src\OpenAI.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
Expand All @@ -17,4 +16,4 @@
<PackageReference Include="Moq" Version="[4.18.2]" />
<PackageReference Include="System.ClientModel" Version="1.1.0-alpha.20240227.1" />
</ItemGroup>
</Project>
</Project>
6 changes: 4 additions & 2 deletions tsp-output/@typespec/openapi3/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5204,6 +5204,7 @@ components:
bytes:
type: integer
format: int64
nullable: true
description: The size of the file, in bytes.
created_at:
type: integer
Expand Down Expand Up @@ -5375,8 +5376,9 @@ components:
nullable: true
description: The last error associated with this run. Will be `null` if there are no errors.
expires_at:
type: integer
format: unixtime
type: string
format: date-time
nullable: true
description: The Unix timestamp (in seconds) for when the run will expire.
started_at:
type: string
Expand Down

0 comments on commit 6604f76

Please sign in to comment.