Skip to content

Commit

Permalink
fix for #27
Browse files Browse the repository at this point in the history
  • Loading branch information
ssvaidyanathan committed Jun 16, 2021
1 parent 1d2c339 commit ab70907
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 7 deletions.
44 changes: 40 additions & 4 deletions samples/Drupal8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,9 @@ For example, the default Categories field on API Doc is associated with the "API

Here is a sample metadata file (apicatalog-config.json) :

**NOTE: Support for API spec image is available from v2.1.2. Make sure the image is in the same folder as the spec and include the name of the file in the config file (see below)**

```
{
"fields":{
"field_image": "pets.jpeg",
"field_business_unit": "ABC",
"field_multi_value":[
"item1",
Expand Down Expand Up @@ -129,11 +126,50 @@ Here is a sample metadata file (apicatalog-config.json) :
```

NOTE: The fields and taxonomy should be pre-configured in the portal. Please provide the correct field, vocabulary names.
**NOTE: The fields and taxonomy should be pre-configured in the portal. Please provide the correct field, vocabulary names.**

`mvn install -Pdev -Dapigee.smartdocs.config.options=create -Dapigee.smartdocs.config.file=./apicatalog-config.json`


### Support for images (from v2.1.3)

Make sure the image is in the **same folder as the spec** and include the name of the file in the config file (see below)

```
{
"fields":{
"field_image": "pets.jpeg",
"field_business_unit": "ABC",
"field_multi_value":[
"item1",
"item2"
]
},
"taxonomy_terms":[
{
"vocabulary":"capability",
"field":"field_capability",
"data":[
"Capability1",
"Capability2"
]
},
{
"vocabulary":"api_category",
"field":"field_categories",
"data":[
"Mobile"
]
}
]
}
```

The plugin supports the following with images:
- Create an API with image
- Update the spec without updating the image. If you want to update the image, please use the `sync` option
- Updating the image or deleting an image alone is not possible. Please use the `sync` option

### Troubleshooting

#### 404 Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,11 @@ private static ByteArrayContent constructAPIDocRequestBody(ServerProfile profile
}
//no need to add to attributes for "field_image"
else if (key!=null && key.equals("field_image")){
hasImage = true;
imageFile = new File(profile.getPortalDirectory()+"/"+(String)fieldsMap.get(key));
String image = (String)fieldsMap.get(key);
if(image!=null && !image.equals("")) {
hasImage = true;
imageFile = new File(profile.getPortalDirectory()+"/"+(String)fieldsMap.get(key));
}
}
else
attributes.addProperty(key, (String)fieldsMap.get(key));
Expand Down Expand Up @@ -624,7 +627,8 @@ public static ImageDocObject importImage(ServerProfile profile, File imageFile)
}
return null;

} catch (HttpResponseException e) {
}
catch (HttpResponseException e) {
throw new IOException(exceptionHandler(e));
}
}
Expand Down

0 comments on commit ab70907

Please sign in to comment.