Commit ee7e8fc
Fix six correctness defects in Swagger 2 generation and capturing mocks
Swagger 2 parsing (SwaggerV2.fs):
- Endpoint responses were fed whole Response Objects to Definition.Parse,
so inline {description, schema} responses degraded to Unspecified and
generated Task<unit> clients. Responses now go through Response.Parse
and use its schema; $refs are handled as before. Inline endpoint
schemas (responses and parameters) are also now seeded into type
generation, so anonymous inline object schemas get generated types.
- Response keys were unconditionally Int32.Parsed, so any spec with a
"default" response aborted generation. Responses are now keyed by a
ResponseKey DU (Code of int | Default), and the generator explicitly
ignores Default when selecting the success response.
Swagger 2 client generation (SwaggerClientGenerator.fs):
- Integer formats were ignored; "format": "int64" now renders as int64
instead of narrowing 64-bit IDs to int.
- The request Content-Type header was derived from Produces, and
Consumes was dropped entirely. Content-Type now comes from Consumes
and Produces is sent as the Accept header, both as full MIME strings
(endpoint-level lists override the spec-global ones). This made the
StartsWith active pattern dead, so Text.fs is deleted.
- SwaggerParameter.Required was parsed and discarded, making every
parameter mandatory. Query parameters without required: true are now
option-typed, and None is omitted from the URL.
HTTP client generation (HttpClientGenerator.fs):
- Option-typed [<Query>] parameters are supported: the query string is
now computed at runtime and appended (with separator) only when
nonempty, so a URL with all-None query parameters stays bare.
Capturing mock generation (CapturingInterfaceMockGenerator.fs):
- Property getters logged nothing; they now record into Calls under a
lock, like methods do.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 039eb3b commit ee7e8fc
17 files changed
Lines changed: 5432 additions & 2314 deletions
File tree
- ConsumePlugin
- WoofWare.Myriad.Plugins.Test
- TestCapturingMockGenerator
- TestHttpClient
- TestSwagger
- WoofWare.Myriad.Plugins
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
559 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
560 | 565 | | |
561 | 566 | | |
562 | 567 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
430 | 438 | | |
431 | 439 | | |
432 | 440 | | |
433 | 441 | | |
434 | 442 | | |
435 | 443 | | |
436 | 444 | | |
437 | | - | |
438 | | - | |
| 445 | + | |
| 446 | + | |
439 | 447 | | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
445 | 453 | | |
446 | 454 | | |
447 | 455 | | |
| |||
478 | 486 | | |
479 | 487 | | |
480 | 488 | | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
481 | 497 | | |
482 | 498 | | |
483 | 499 | | |
484 | 500 | | |
485 | 501 | | |
486 | 502 | | |
487 | 503 | | |
488 | | - | |
489 | | - | |
| 504 | + | |
| 505 | + | |
490 | 506 | | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
496 | 512 | | |
497 | 513 | | |
498 | 514 | | |
| |||
1967 | 1983 | | |
1968 | 1984 | | |
1969 | 1985 | | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
1970 | 2096 | | |
1971 | 2097 | | |
1972 | 2098 | | |
| |||
0 commit comments