Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Model Docs to scala-akka generator as defined in its README #11684

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code
protected String artifactId = "openapi-client";
protected String artifactVersion = "1.0.0";
protected String resourcesFolder = "src/main/resources";
protected String modelDocPath = "docs/";
protected String configKey = "apiRequest";
protected int defaultTimeoutInMs = 5000;
protected String configKeyPath = mainPackage;
Expand Down Expand Up @@ -85,6 +86,7 @@ public ScalaAkkaClientCodegen() {
outputFolder = "generated-code/scala-akka";
modelTemplateFiles.put("model.mustache", ".scala");
apiTemplateFiles.put("api.mustache", ".scala");
modelDocTemplateFiles.put("model_doc.mustache", ".md");
embeddedTemplateDir = templateDir = "scala-akka-client";
apiPackage = mainPackage + ".api";
modelPackage = mainPackage + ".model";
Expand Down Expand Up @@ -164,6 +166,7 @@ public void processOpts() {
}
}
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
additionalProperties.put("modelDocPath", modelDocPath);

supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt"));
Expand Down Expand Up @@ -360,4 +363,9 @@ public String escapeQuotationMark(String input) {
public void setMainPackage(String mainPackage) {
this.configKeyPath = this.mainPackage = mainPackage;
}

@Override
public String modelDocFileFolder() {
return (outputFolder + File.separator + modelDocPath).replace('/', File.separatorChar);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# {{#vendorExtensions.x-is-one-of-interface}}Trait {{/vendorExtensions.x-is-one-of-interface}}{{classname}}

{{#description}}{{&description}}
{{/description}}

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isEnum}}[**{{datatypeWithEnum}}**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}[{{/isModel}}{{/items}}**{{baseType}}{{#items}}<{{dataType}}>**{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}[{{/isModel}}**Map<String, {{dataType}}>**{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}[{{/isModel}}**{{dataType}}**{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/isContainer}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}}
{{/vars}}
{{#vars}}{{#isEnum}}

## Enum: {{datatypeWithEnum}}
Allowed values: {{#allowableValues}}[{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}}

{{/isEnum}}{{/vars}}
{{#vendorExtensions.x-implements.0}}

## Implemented Interfaces

{{#vendorExtensions.x-implements}}
* {{{.}}}
{{/vendorExtensions.x-implements}}
{{/vendorExtensions.x-implements.0}}
{{#vendorExtensions.x-is-one-of-interface}}
## Implementing Classes

{{#oneOf}}
* {{{.}}}
{{/oneOf}}
{{/vendorExtensions.x-is-one-of-interface}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# {{classname}}

## Enum

{{#allowableValues}}{{#enumVars}}
* `{{name}}` (value: `{{{value}}}`)
{{/enumVars}}{{/allowableValues}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{#models}}{{#model}}

{{#isEnum}}
{{>enum_doc}}
{{/isEnum}}
{{^isEnum}}
{{>class_doc}}
{{/isEnum}}
{{/model}}{{/models}}
6 changes: 6 additions & 0 deletions samples/client/petstore/scala-akka/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
README.md
build.sbt
docs/ApiResponse.md
docs/Category.md
docs/Order.md
docs/Pet.md
docs/Tag.md
docs/User.md
project/build.properties
src/main/resources/reference.conf
src/main/scala/org/openapitools/client/api/EnumsSerializers.scala
Expand Down
12 changes: 6 additions & 6 deletions samples/client/petstore/scala-akka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ Class | Method | HTTP request | Description

## Documentation for Models

- [ApiResponse](ApiResponse.md)
- [Category](Category.md)
- [Order](Order.md)
- [Pet](Pet.md)
- [Tag](Tag.md)
- [User](User.md)
- [ApiResponse](docs/ApiResponse.md)
- [Category](docs/Category.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)


## Documentation for Authorization
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/scala-akka/docs/ApiResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


# ApiResponse

Describes the result of uploading an image resource

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **Int** | | [optional]
**`type`** | **String** | | [optional]
**message** | **String** | | [optional]



15 changes: 15 additions & 0 deletions samples/client/petstore/scala-akka/docs/Category.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


# Category

A category for a pet

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**name** | **String** | | [optional]



24 changes: 24 additions & 0 deletions samples/client/petstore/scala-akka/docs/Order.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@


# Order

An order for a pets from the pet store

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**petId** | **Long** | | [optional]
**quantity** | **Int** | | [optional]
**shipDate** | **OffsetDateTime** | | [optional]
**status** | [**Status**](#Status) | Order Status | [optional]
**complete** | **Boolean** | | [optional]


## Enum: Status
Allowed values: [placed, approved, delivered]




24 changes: 24 additions & 0 deletions samples/client/petstore/scala-akka/docs/Pet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@


# Pet

A pet for sale in the pet store

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**category** | [**Category**](Category.md) | | [optional]
**name** | **String** | |
**photoUrls** | **Seq<String>** | |
**tags** | [**Seq<Tag>**](Tag.md) | | [optional]
**status** | [**Status**](#Status) | pet status in the store | [optional]


## Enum: Status
Allowed values: [available, pending, sold]




15 changes: 15 additions & 0 deletions samples/client/petstore/scala-akka/docs/Tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


# Tag

A tag for a pet

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**name** | **String** | | [optional]



21 changes: 21 additions & 0 deletions samples/client/petstore/scala-akka/docs/User.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@


# User

A User who is purchasing from the pet store

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**username** | **String** | | [optional]
**firstName** | **String** | | [optional]
**lastName** | **String** | | [optional]
**email** | **String** | | [optional]
**password** | **String** | | [optional]
**phone** | **String** | | [optional]
**userStatus** | **Int** | User Status | [optional]