299 Commits

Author SHA1 Message Date
William Cheng
e2c458b9ea
Prepare 7.10.0 (#19809)
* Revert "prepare 7.9.0 release (#19808)"

This reverts commit 4145000dfebe7a9edea4555c8515383da7602458.

* prepare 7.10.0 snapshot

* update doc

* update samples
2024-10-08 11:21:54 +08:00
Richard Whitehouse
fb36272358
[Rust Server] Handle arrays in forms (#19625)
* [Rust Server] Handle arrays in forms correctly

* [Rust Server] Add tests

* Update samples
2024-09-23 00:20:48 +08:00
Richard Whitehouse
8821cf095e
[Core/Rust Server] Check references in additionalProperties correctly when checking freeForm status (#19605)
* Check references in additionalProperties correctly

Handle references in additionalProperties correctly when determining free-form status

* Update samples
2024-09-23 00:19:27 +08:00
Richard Whitehouse
d03c90cb97
[Rust Server] Handle additional properties being nullable (#19594)
With:
```
    sampleObject:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/SampleData'
      minProperties: 1
      description: Map of Charging data policy decisions.
```

and
```
    SampleData:
      type: object
...
      nullable: true
```

We currently generate: HashMap<String, SampleData>, which doesn't allow
null charging data entries. This MR changes this to be
`HashMap<String, swagger::Nullable<SampleData>>`, which thus will allow null data entries.

We do this by moving null-handling to the Java code - primarily `getTypeDeclaration()`.

Note, to some extent this is wrong. In this MR (and previously) we are treating
`nullable: true` as an extrinsic property (like required), whereas it should be an
intrinsic property (and thus `HashMap<String, SampleData>` is correct, but `SampleData`
absorbs the nullability.

This would be possible with this code:

```
enum ChargingData = {
   Null,
   Present {
       ...
   }
}
```

Which would remove the usage of https://docs.rs/swagger/2.0.2/swagger/nullable_format/enum.Nullable.html.

I haven't resolved this - and have instead done a more targeted fix.

This, along with some other crude code, creates a scenario where we need to
unpick whether something is null. I've left that, though flagged a TODO to tidy it up at some point.
2024-09-18 15:25:06 +08:00
Richard Whitehouse
f07f8bc997
[Rust Server] Add derive of Hash to enums (#19603)
* [Rust Server] Add derive of Hash to enums

* Update samples
2024-09-18 15:23:27 +08:00
Richard Whitehouse
cf5d17bbfe
[Rust Server] Convert Rust comment to Mustache (#19595)
* [Rust Server] Convert Rust comment to Mustache

The comment about auth types supported by the generator shouldn't be
included in the generated code as it's confusing when the API doesn't
support the same auth types.

As such, we convert it from a Rust comment to a Mustache comment

* Update samples
2024-09-18 15:22:51 +08:00
Richard Whitehouse
2b40a2c058
[Rust Server] Add auto-generated CLI Client (#19392)
* [Rust Server] Add auto-generated CLI tool

* [Rust Server] Test multiple path parameters

* [Rust Server] Test boolean parameters and apostrophes

* [Rust Server] Test operation with two boolean parameters with same first letter

* [Rust Server] Test apostrophes in operation summary

* Update samples

* [Rust Server] Fix build errors with OpenSSL

* Update samples

* Update samples
2024-08-24 23:57:03 +08:00
Richard Whitehouse
eda4547f15
[Rust Server] Fix up model generation (#19363)
* [Rust Server] Fix up model generation

- Correctly generate anyOf/oneOf models
- Fix up ToString / FromStr support
- Disable PartialOrd generation for anyOf/oneOf models
- Generate models for inline enums
- Support enums in headers, and vectors of models in headers

* [Rust Server] Add test for anyOf with additional properties

* Update samples

* [Rust Server] Tidy up logging
2024-08-21 15:14:52 +08:00
William Cheng
91da2fd240
Prepare 7.9.0 snapshot (#19386)
* Revert "v7.8.0 release (#19385)"

This reverts commit 6bdc452f92d49dcac7ac21dfe8751c8cc4267b98.

* update samples for v7.9.0-snapshot
2024-08-19 16:14:51 +08:00
Richard Whitehouse
df2b4210c9
[Rust Server] Sort operations so that the ones with fewest params come first (#19368)
* [Rust Server] Sort operations so that the ones with fewest params come first

This resolves things correctly per
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#pathsObject
- "When matching URLs, concrete (non-templated) paths would be matched
before their templated counterparts."

* Update samples

* [Rust Server] Fix tabs vs spaces

---------

Co-authored-by: Rob Day <Robert.Day@metaswitch.com>
2024-08-18 18:01:19 +08:00
Richard Whitehouse
0a5c99739a
[Rust Server] Allow configuration of multipart/form attachment size limit (#19371)
* [Rust Server] Allow configuration of multipart/form attachment size limit

multipart 0.14+ imposes a 8MB size limit on multipart/form bodies.

This allows that limit to be configured. The default is left as is.

This also improves error messages produced when handling multipart/form bodies.

* Update samples
2024-08-17 16:02:20 +08:00
Richard Whitehouse
172fafe674
[Rust Server] Fix server-writing docs for rust-server (#19367)
* Fix server-writing docs for rust-server

Fix broken link in generated README for rust-server.

* Update samples

---------

Co-authored-by: Keith Wansbrough <Keith.Wansbrough@metaswitch.com>
2024-08-17 15:33:58 +08:00
Richard Whitehouse
fbe6c11903
[Rust] Ensure all features build as part of CI / Upgrade to Frunk 0.4 (#19364)
* [Rust] [CI] Build all features as part of CI

* [Rust Server] Update to frunk 0.4

* Update samples
2024-08-17 14:17:36 +08:00
Richard Whitehouse
024bbb7784
[Rust Server] Improve RFC 13341 compliance for multipart/related (#19355)
* [Rust Server] Improve RFC 13341 compliance for multipart/related

* Update samples
2024-08-15 17:04:59 +08:00
Richard Whitehouse
be09f8a868
[Rust Server] Use swagger/multipart_related support (#19354)
* [Rust Server] Use swagger/multipart_related support

* Update samples
2024-08-15 17:03:59 +08:00
Richard Whitehouse
daf52229e3
[Rust Server] Refactor Mustache templates for request/response body handling (#19347)
* [Rust Server] Refactor Mustache templates for request/response body handling

* Update samples
2024-08-14 15:25:08 +08:00
Richard Whitehouse
b8001323f6
[Core] Consolidate Operation ID generation (#19339)
* [Core] Consolidate Operation ID generation

* Update samples
2024-08-14 15:12:26 +08:00
Richard Whitehouse
ad7acc30eb
[Rust/Rust Server] Fix example/test code (#19318)
* [Rust Server] Fix code so examples compile

Zero length arrays don't correctly type infer, so if we have no scopes, we need to not create a empty array

We need an authentication middleware - without it the code doesn't compile.

* Update samples

* [Rust Server] Remove trailing whitespace

* Update samples

* [Rust Server] [CI] Build all targets

* [Rust] Fix reqwest test
2024-08-09 15:54:58 +08:00
William Cheng
20cfce0b4a
Prepare v7.8.0 (#19048)
* Revert "v7.7.0 release"

This reverts commit f3dd32385e02065ad298801ca11b8871bcb3a92a.

* prepare v7.8.0

* update readme

* update doc

* update samples
2024-07-02 16:45:53 +08:00
Nathaniel Cook
640ef9d944
fix(rust-server): remove duplicate allow(unused_imports) directive (#18983)
New versions of rust clippy catch errors with duplicate allow
directives. This change fixes the duplicate directives in generated rust
code.
2024-06-20 22:14:57 +08:00
cvkem
5e8b589bea
Fix rust server auth (#18692)
* Added authentication via Bearer-token api_key and basic for server and client

* Improved errorhandling

* Added check on oAuth audience to example

* Updates of the petstore files for Rust-server

* Moved module import to prevent issue in callbacks

* updated samples

* Fix for unused-qualifications issue

* updated sampmles
2024-05-26 16:04:14 +08:00
William Cheng
741bf0c035
Prepare 7.7.0-SNAPSHOT (#18709)
* Revert "7.6.0 release"

This reverts commit d76f9d32d11a03be2b40ebff728ef0ff86332fcb.

* prepare 7.7.0 snapshot in master

* update samples
2024-05-20 17:27:17 +08:00
Max Nachlinger
03389dfdbd
Bump Rust edition to 2021 and a few crates (#18608)
* bump Rust edition to 2021, update a few creates

* bump Rust edition to 2021, update a few creates
2024-05-09 10:43:11 +08:00
Max Nachlinger
ac649b2e2f
Disable clippy::too_many_arguments in generated Rust client code. (#18601) 2024-05-08 11:52:20 +08:00
myz-dev
b1fac19a75
Fix #18572 rust server: Silence clippy lints by refactoring (#18575)
* refactor: move closure definition to own statement

A clippy lint recommends not using a closure inside of a statement.
The code generation used to produce code that triggered this warning,
which caused the rust-server integration test to fail because clippy is
configured to return lint violations as errors.
For details for the lint see:
https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions

* refactor: Remove unnecessary qualification

A GitHub action test used to fail because of a clippy warning that was
emitted due to not using an imported symbol but qualifying its use.
A failed test can be seen here:
https://github.com/OpenAPITools/openapi-generator/actions/runs/8958257509/job/24603984954?pr=18563
With the relevant error being:

error: unnecessary qualification
  --> output/openapi-v3/src/client/callbacks.rs:88:9
   |
88 |         futures::future::ok(Service::new(

This commit simply removes the qualification.

* test: Update examples and run integration test.

Updated examples by running
`./bin/generate-samples.sh ./bin/configs/rust-server-*`
The integration test with the following command passes:
`mvn integration-test -f samples/server/petstore/rust-server/pom.xml`
2024-05-06 12:24:33 +08:00
William Cheng
807250a430
Prepare 7.6.0 (#18412)
* Revert "v7.5.0 release"

This reverts commit 1eafe2aebf33b13bee0ead66d62a6436e7db059d.

* update master to v7.6.0 snapshot

* update readme

* update samples
2024-04-17 19:05:37 +08:00
William Cheng
4ff7e0ec3f
Prepare 7.5.0 snapshot (#18068)
* Revert "7.4.0 release"

This reverts commit eda049348425171df772a7b9087cc97db718cfda.

* prepare 7.5.0 snapshot version

* update samples

* update doc
2024-03-11 11:10:52 +08:00
Ross Bender
cf2435f335
Add support for controlling output of OpenAPI Generator version in generated files (#17952)
* add initial openapi config and java generated files

* add java implementation for adding generator version

* regenerate sample client files

* remove tabs

* only show generated version if build info exists

* set build info for batch generation

* update generator doc for new global flag

* use existing property for generator version

* update templates to include generator version

* update templates for better generator version syntax

* revert undesired changes

* regenerate samples for openapi client

* update templates to correct formatting/newlines

* correct description text and add to usage doc

* add generator cli option for all codegen types

* use more concise version info; update existing codegens to support new prop

* correct wrong prop reference

* add initial test coverage for new prop

* update last (scala) templates with new prop

* update samples after upstream merge

* use consistent version output

* use better sample project id/name

* revert using option for generator version in templates
2024-03-09 15:52:08 +08:00
Chris Miller
4ba187a1a4
Provide rust-server swagger/multipart_form (#17950)
* grant rust server swagger form multipart

* run exporters
2024-02-25 17:18:15 +08:00
Simon Podlipsky
1e9bccca16
feat: generate EOL in VERSION file (#17829)
The EOL is missing so let's add it in order to comply with POSIX standard:

Line
> A sequence of zero or more non- <newline> characters plus a terminating <newline> character.
2024-02-12 15:40:55 +08:00
William Cheng
783e68c7ac
7.4.0 snapshot (#17818)
* Revert "7.3.0-release (#17817)"

This reverts commit d617b46c86b9075c5e0d63fe3798e2982f5259ac.

* update samples, docs, readme
2024-02-08 16:07:22 +08:00
William Cheng
5eab3cef19
Prepare 7.3.0-SNAPSHOT (#17456)
* Revert "v7.2.0 release (#17455)"

This reverts commit fe638d009363c142c246ff089032f243e0b4ee01.

* set version to 7.3.0-SNAPSHOT

* update doc
2023-12-22 16:55:58 +08:00
William Cheng
46dd87525e
Add tests for max,min items in array (rust-server) (#17215)
* add tests for max,min items in array (rust server)

* fix both min, max items
2023-11-29 16:21:54 +08:00
Markus Lenger
1ce95ff41e
Map type date to correct rust type NaiveDate (#17095)
* Fix clippy errors (rustc 1.73.0)

* Add feature docker-in-docker

* Fix mapping of "date"

See issue #9769

The type
  type: string
  format: date
was mapped to DateTime<Utc> which violates the OpenAPI spec

see https://swagger.io/docs/specification/data-models/data-types/
2023-11-18 10:33:45 +08:00
William Cheng
53289263d9
Prepare v7.2.0 (#17050)
* update version to 7.2.0-SNAPSHOT

* update samples

* update doc
2023-11-13 18:53:20 +08:00
Nathaniel Cook
fbd02554f5
fix(rust-server): remove redundant clone (#16906)
The generated example code would clone the context. However as context
is a generic type and is not declared to implement Clone, a clone of a
reference is just a copy of the reference and therefore unnecessary.
This change removes the redundant call and therefore avoids the `cargo
clippy` warning.
2023-10-27 11:06:34 +08:00
William Cheng
5e8e2d7f6d
Prepare v7.1.0 in master (#16608)
* prepare v7.1.0 in master

* update
2023-09-18 17:37:36 +08:00
William Cheng
80121aa88f
Prepare v7.0.1 (#16409)
* prepare 7.0.1 in master

* update doc
2023-08-25 16:11:29 +08:00
Erik Wegner
389270334a
Rust validation handling (#15288)
* Prevent JavaScript regex delimiter

* Validation

* validator dependency

* validation with range

* Switch to garde crate for validation

* Update uuid crate

* Examples

* All rust-server samples

* Added rule handling

* Exchange garde for validator crate (rust)

* Version update in samples

---------

Co-authored-by: Erik Wegner <erik.wegner@regiocom.com>
2023-06-16 15:25:27 +08:00
William Cheng
6788f43af0
Better handling of Inline schema (#15682)
* skip allOf inline subschema created as $ref

* add option for fallback

* add back atleastonemodel

* add log

* update java, kotlin, js samples

* update tests

* fix native client test

* fix java client errors by regenerating test files

* clean up python

* clean up powershell

* clean up php

* clean up ruby

* update erlang, elixir

* update dart samples

* update ts samples

* update r, go samples

* update perl

* update swift

* add back files

* add back files

* remove outdated test files

* fix test
2023-06-11 15:35:58 +08:00
William Cheng
0c3460f95b Merge remote-tracking branch 'origin/master' into 7.0.x 2023-05-10 15:00:56 +08:00
Tiffany Marrel
ef35e6d7ea
[rust] fix documentation of API authorization in README files (#15352)
fix hierarchy level + align wording across generators
2023-05-09 14:30:54 +08:00
William Cheng
935146d187 Merge remote-tracking branch 'origin/master' into 7.0.x 2023-04-12 17:51:47 +08:00
William Cheng
5d1e18306a
Prepare 6.6.0-SNAPSHOT (#15100)
* set 6.6.0 snapshot version

* update samples

* update readme
2023-04-01 18:48:01 +08:00
William Cheng
7417432a54
Prepare 6.5.0 release (#15099)
* 6.5.0 release

* update samples
2023-04-01 15:03:35 +08:00
William Cheng
e38ea578f8
Better support of inline allOf/anyOf/oneOf schemas (#14887)
* better support of inilne allof schemas

* add test file

* better handling of anyof, oneof inline schemas

* update samples

* add tests for nested anyof

* better code format
2023-03-07 15:53:53 +08:00
William Cheng
1beec7ef87 Merge remote-tracking branch 'origin' into 7.0.x 2023-03-03 21:52:50 +08:00
Naoki Ikeguchi
9290c1a75e
[rust-server] Fix clippy warnings (#13907)
* fix(rust-server): clippy::blacklisted_name -> clippy::disallowed_names

* fix(rust-server): Remove unnecessary deref

* fix(rust-server): Allow clippy::single_match

* fix(rust-server): Use clone instead of to_owned on Cow

* fix(rust-server): Remove needless borrows

* chore(rust-server): Update sample outputs
2023-02-20 13:46:01 +08:00
William Cheng
c50a775e0c
prepare 6.5.0 release (#14749) 2023-02-19 20:36:23 +08:00
William Cheng
93df0ff444
Prepare 6.4.0 release (#14748)
* prepare 6.4.0 release

* update samples
2023-02-19 18:53:20 +08:00