Skip to content

Commit 44f424a

Browse files
committed
Improve API layer and usability, make more type safe
1 parent d439df5 commit 44f424a

29 files changed

Lines changed: 1309 additions & 276 deletions

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: 8.0.x
20+
21+
- name: Restore
22+
run: dotnet restore ./Fable.Remoting.OpenApi.sln
23+
24+
- name: Build solution
25+
run: dotnet build ./Fable.Remoting.OpenApi.sln -c Release --no-restore
26+
27+
- name: Test solution
28+
run: dotnet test ./Fable.Remoting.OpenApi.sln -c Release --no-build
29+
30+
publish:
31+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
32+
runs-on: ubuntu-latest
33+
needs: build-test
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Setup .NET
39+
uses: actions/setup-dotnet@v4
40+
with:
41+
dotnet-version: 8.0.x
42+
43+
- name: Restore
44+
run: dotnet restore ./Release.sln
45+
46+
- name: Pack
47+
run: |
48+
mkdir -p artifacts
49+
dotnet pack ./Release.sln -c Release --no-restore -o artifacts
50+
51+
- name: Publish to NuGet
52+
if: ${{ secrets.NUGET_API_KEY != '' }}
53+
run: dotnet nuget push "artifacts/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key "${{ secrets.NUGET_API_KEY }}" --skip-duplicate

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bin/
2+
obj/
3+
artifacts/
4+
.idea/

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"dotnet test": true,
44
"ForEach-Object": true,
55
"Set-Content": true,
6-
"dotnet fsi": true
6+
"dotnet fsi": true,
7+
"dotnet build": true
78
}
89
}

AGENTS.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# AGENTS
2+
3+
Instructions for future AI coding agents working in this repository.
4+
5+
## Repository Overview
6+
7+
- Core library: src/Fable.Remoting.OpenAPI
8+
- Giraffe adapter: src/Fable.Remoting.OpenAPI.Giraffe
9+
- Suave adapter: src/Fable.Remoting.OpenAPI.Suave
10+
- Main solution (development/test): Fable.Remoting.OpenApi.sln
11+
- Release solution (pack/publish): Release.sln
12+
- Integration playground: app
13+
- Core tests: tests/Fable.Remoting.OpenAPI
14+
- Adapter tests: tests/Fable.Remoting.OpenAPI.Adapters
15+
16+
## Standard Commands
17+
18+
- Restore workspace:
19+
- dotnet restore ./Fable.Remoting.OpenApi.sln
20+
- Build workspace:
21+
- dotnet build ./Fable.Remoting.OpenApi.sln --no-restore
22+
- Run tests:
23+
- dotnet test ./Fable.Remoting.OpenApi.sln
24+
- Restore release solution:
25+
- dotnet restore ./Release.sln
26+
- Pack release artifacts:
27+
- dotnet pack ./Release.sln -c Release --no-restore -o artifacts
28+
29+
## Important Behavioral Contracts
30+
31+
- OpenAPI generation should stay aligned with Fable.Remoting semantics:
32+
- Unit input endpoints map to GET.
33+
- Non-unit input endpoints map to POST.
34+
- Remoting request body shape is JSON array.
35+
- Route-builder integration must remain first-class:
36+
- OpenAPI.withDocs should follow active remoting route builder.
37+
- Default docs routes derive from route builder and API type name unless explicitly overridden.
38+
39+
## Architecture Boundaries
40+
41+
- Keep framework-specific HTTP handler code out of core library.
42+
- Core project should remain framework-agnostic and focused on:
43+
- metadata extraction
44+
- document model creation
45+
- deterministic rendering
46+
- Adapter projects own web framework composition helpers.
47+
48+
## Test and Change Discipline
49+
50+
- Add or update tests when behavior changes.
51+
- Prefer deterministic assertions for JSON/YAML output.
52+
- If changing route or transport semantics, update:
53+
- core tests
54+
- adapter tests
55+
- sample app docs links
56+
- README and CONTRIBUTING
57+
58+
## CI Alignment
59+
60+
- CI is solution-driven. Keep workflow commands targeting:
61+
- ./Fable.Remoting.OpenApi.sln for restore/build/test
62+
- ./Release.sln for restore/pack
63+
- Keep publish command using --skip-duplicate.
64+
65+
## Safety Notes
66+
67+
- Do not revert unrelated user changes in working tree.
68+
- Avoid introducing framework coupling into core project references.
69+
- Preserve package version compatibility across adapter and core projects.

CONTRIBUTING.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Contributing
2+
3+
## Prerequisites
4+
5+
- .NET SDK 8.0+
6+
- Node.js 18+ (required for sample app client tooling)
7+
8+
## Repository Layout
9+
10+
- `src/Fable.Remoting.OpenAPI`: Core OpenAPI generator and options.
11+
- `src/Fable.Remoting.OpenAPI.Giraffe`: Giraffe adapter and remoting composition API.
12+
- `src/Fable.Remoting.OpenAPI.Suave`: Suave docs adapter/composition helpers.
13+
- `tests/Fable.Remoting.OpenAPI`: Core behavior tests.
14+
- `tests/Fable.Remoting.OpenAPI.Adapters`: Adapter parity and integration-shape tests.
15+
- `app/`: SAFE sample application.
16+
17+
## Setup
18+
19+
1. Restore .NET dependencies:
20+
21+
```bash
22+
dotnet restore ./Fable.Remoting.OpenApi.sln
23+
```
24+
25+
2. Build the full workspace solution:
26+
27+
```bash
28+
dotnet build ./Fable.Remoting.OpenApi.sln --no-restore
29+
```
30+
31+
## Testing
32+
33+
Run the package test suite:
34+
35+
```bash
36+
dotnet test ./Fable.Remoting.OpenApi.sln
37+
```
38+
39+
Optional targeted test run:
40+
41+
```bash
42+
dotnet test app/tests/Server/Server.Tests.fsproj
43+
```
44+
45+
## Packaging
46+
47+
Restore and pack publishable projects via release solution:
48+
49+
```bash
50+
dotnet restore ./Release.sln
51+
dotnet pack ./Release.sln -c Release --no-restore -o artifacts
52+
```
53+
54+
Push packages manually:
55+
56+
```bash
57+
dotnet nuget push "artifacts/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key <NUGET_API_KEY> --skip-duplicate
58+
```
59+
60+
## Release Notes
61+
62+
Each project under `src` keeps release notes in a local `CHANGELOG.md`.
63+
`EasyBuild.PackageReleaseNotes.Tasks` is configured through `Directory.Build.props` so package release notes are populated at pack time.

Directory.Build.props

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project>
2+
<PropertyGroup>
3+
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
4+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<!-- Depends on the same version of FSharp.Core for all the projects -->
8+
<PackageReference Include="FSharp.Core" PrivateAssets="all" />
9+
</ItemGroup>
10+
</Project>

0 commit comments

Comments
 (0)