Compare commits

...

14 Commits

Author SHA1 Message Date
Hugo de Paix de Coeur
85c5b7aa97 switched swagger-parser to 1.0.21-SNAPSHOT
Added a use case in tests : object array with examples
Added a workaround for object array examples because swagger-parser returns a string and not an ArrayNode as expected
2016-06-10 11:45:19 +02:00
Hugo de Paix de Coeur
662cc3f40f Added inline schemas in generatedExample test
Ignore inline schema tests because of a bug in swagger-parser-1.0.21
2016-06-10 11:42:05 +02:00
Hugo de Paix de Coeur
1eac6a63d9 set development version to 1.0.1-SNAPSHOT 2016-05-26 16:21:42 +02:00
Hugo de Paix de Coeur
6e379042a0 #152 keep track of properties order in Composed models so that OrderBy.AS_IS works as expected 2016-05-26 13:22:37 +02:00
hdr
8367195315 fixes #150 create empty object when Swagger Parser fails to convert composed items
Added Instagram API conversion to tests next to PetStore
2016-05-26 11:23:26 +02:00
Hugo de Paix de Coeur
7de954958d Merge pull request #151 from johanhammar/master
Fix invalid XML in documentation
2016-05-26 08:24:39 +02:00
Johan Hammar
a161924a7f Fix invalid XML in documentation 2016-05-25 21:24:19 +02:00
hdr
9568f3a960 #148 Removed NPE in ExamplesUtil::exampleMapForProperties 2016-05-24 14:20:37 +02:00
Robert Winkler
3c0f935e99 Merge remote-tracking branch 'origin/master' 2016-05-12 09:54:49 +02:00
Robert Winkler
826f4ff762 Updated images 2016-05-12 09:54:39 +02:00
Robert Winkler
ed926139b8 Updated readme 2016-05-04 21:05:59 +02:00
Robert Winkler
cb23bfe1a4 Updated Bintray badge 2016-05-02 13:22:04 +02:00
Robert Winkler
ab7d355fe4 Prepare release v1.0.0 2016-05-02 13:06:54 +02:00
Robert Winkler
87ccc182f1 Prepare release v1.0.0 2016-04-29 14:12:21 +02:00
25 changed files with 3156 additions and 44 deletions

View File

@@ -2,7 +2,7 @@
:author: Robert Winkler
:hardbreaks:
image:https://travis-ci.org/Swagger2Markup/swagger2markup.svg?branch=master["Build Status", link="https://travis-ci.org/Swagger2Markup/swagger2markup"] image:https://coveralls.io/repos/Swagger2Markup/swagger2markup/badge.svg["Coverage Status", link="https://coveralls.io/r/Swagger2Markup/swagger2markup"] image:https://api.codacy.com/project/badge/grade/498a6a39d7d84ff687546359f58ee18d["Codacy code quality", link="https://www.codacy.com/app/robwin/swagger2markup"] image:https://api.bintray.com/packages/robwin/maven/swagger2markup/images/download.svg[link="https://bintray.com/robwin/maven/swagger2markup/_latestVersion"] image:http://img.shields.io/badge/license-ASF2-blue.svg["Apache License 2", link="http://www.apache.org/licenses/LICENSE-2.0.txt"] image:https://img.shields.io/badge/Twitter-rbrtwnklr-blue.svg["Twitter", link="https://twitter.com/rbrtwnklr"] image:https://badges.gitter.im/Join%20Chat.svg[link="https://gitter.im/RobWin/swagger2markup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"]
image:https://travis-ci.org/Swagger2Markup/swagger2markup.svg?branch=master["Build Status", link="https://travis-ci.org/Swagger2Markup/swagger2markup"] image:https://coveralls.io/repos/Swagger2Markup/swagger2markup/badge.svg["Coverage Status", link="https://coveralls.io/r/Swagger2Markup/swagger2markup"] image:https://api.codacy.com/project/badge/grade/498a6a39d7d84ff687546359f58ee18d["Codacy code quality", link="https://www.codacy.com/app/robwin/swagger2markup"] image:https://api.bintray.com/packages/swagger2markup/Maven/swagger2markup/images/download.svg[link="https://bintray.com/swagger2markup/Maven/swagger2markup/_latestVersion"] image:http://img.shields.io/badge/license-ASF2-blue.svg["Apache License 2", link="http://www.apache.org/licenses/LICENSE-2.0.txt"] image:https://img.shields.io/badge/Twitter-rbrtwnklr-blue.svg["Twitter", link="https://twitter.com/rbrtwnklr"] image:https://badges.gitter.im/Join%20Chat.svg[link="https://gitter.im/RobWin/swagger2markup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"]
== Overview
@@ -18,7 +18,7 @@ http://asciidoctor.org/docs/asciidoc-writers-guide/[AsciiDoc] is preferable to M
You can generate your HTML5, PDF and EPUB documentation via https://github.com/asciidoctor/asciidoctorj[asciidoctorj] or even better via the https://github.com/asciidoctor/asciidoctor-gradle-plugin[asciidoctor-gradle-plugin] or https://github.com/asciidoctor/asciidoctor-maven-plugin[asciidoctor-maven-plugin].
The project requires at least JDK 7.
The project requires at least JDK 8.
== Example
@@ -27,8 +27,7 @@ image::src/docs/asciidoc/images/Swagger2Markup.PNG[]
image::src/docs/asciidoc/images/Swagger2Markup_definitions.PNG[]
== Reference documentation
- http://swagger2markup.readme.io/[Reference Documentation]
- http://swagger2markup.github.io/swagger2markup/1.0.0-SNAPSHOT/[1.0.0-SNAPSHOT Documentation]
- http://swagger2markup.github.io/swagger2markup/1.0.0/[Reference Documentation]
- https://github.com/Swagger2Markup/swagger2markup/blob/master/RELEASENOTES.adoc[Release notes]
- https://github.com/Swagger2Markup/spring-swagger2markup-demo[Demo using Swagger2Markup, Spring Boot, Springfox and spring-restdocs]
@@ -38,14 +37,6 @@ image::src/docs/asciidoc/images/Swagger2Markup_definitions.PNG[]
Pull requests are welcome.
* New feature https://github.com/Swagger2Markup/swagger2markup/issues/18[Swagger2Markup/swagger2Markup#18] by https://github.com/sg-ad[@sg-ad]: In addition to the definitions.adoc you can also generate separate files for each definition model (ex: person.adoc, address.adoc, purchase.adoc).
* New feature https://github.com/Swagger2Markup/swagger2markup/issues/21[Swagger2Markup/swagger2Markup#21] by https://github.com/redowl[@redowl]: Support for both reference models and composed models.
* New feature https://github.com/Swagger2Markup/swagger2markup/issues/27[Swagger2Markup/swagger2Markup#27] by https://github.com/zmitrok[@zmitrok]: Added a hook to preprocess a Swagger Model before it is converted.
* New feature https://github.com/Swagger2Markup/swagger2markup/issues/48[Swagger2Markup/swagger2Markup#48] by https://github.com/MeteorBoom[@MeteorBoom]: Multi language support.
=== Questions
You can ask questions about Swagger2Markup in https://gitter.im/Swagger2Markup/swagger2markup[Gitter].

View File

@@ -83,4 +83,11 @@
* Enhancement #51 : Support for separated operations files
* Enhancement #52: Markdown generation for inline schemas
== Version 1.0.0
* New configuration API
* New extension SPI
* Added new languages: turkish, german, france
* New security document
* Inline schema support
* New configuration options
* Support of deprecated path operations

View File

@@ -7,13 +7,13 @@ buildscript {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.10.1'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0"
classpath "org.ajoberstar:gradle-git:1.3.2"
}
}
description = 'swagger2markup Build'
version = '1.0.0-SNAPSHOT'
version = '1.0.1-SNAPSHOT'
group = 'io.github.swagger2markup'
apply plugin: 'java'
@@ -35,12 +35,12 @@ repositories {
}
jcenter()
mavenCentral()
//mavenLocal()
mavenLocal()
}
dependencies {
compile 'io.github.swagger2markup:markup-document-builder:1.0.0-SNAPSHOT'
compile 'io.swagger:swagger-compat-spec-parser:1.0.18'
compile 'io.github.swagger2markup:markup-document-builder:1.0.0'
compile 'io.swagger:swagger-compat-spec-parser:1.0.21-SNAPSHOT'
compile 'org.apache.commons:commons-configuration2:2.0'
compile 'commons-beanutils:commons-beanutils:1.9.2'
compile 'org.apache.commons:commons-collections4:4.1'

View File

@@ -97,8 +97,9 @@ bintray {
publish = true //If version should be auto published after an upload
publications = ['mavenJava']
pkg {
repo = 'maven'
repo = 'Maven'
name = 'swagger2markup'
userOrg = 'swagger2markup'
websiteUrl = projectUrl
issueTrackerUrl = issuesUrl
vcsUrl = scmUrl

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

@@ -54,8 +54,8 @@ You can customize the task by configuring a Map of <<Swagger2Markup properties>>
<artifactId>swagger2markup-maven-plugin</artifactId>
<version>{project-version}</version>
<configuration>
<swaggerInput>${project.basedir}/src/docs/swagger/swagger_petstore.yaml</input>
<outputDir>${project.build.directory}/asciidoc</output>
<swaggerInput>${project.basedir}/src/docs/swagger/swagger_petstore.yaml</swaggerInput>
<outputDir>${project.build.directory}/asciidoc</outputDir>
<config>
<swagger2markup.markupLanguage>ASCIIDOC</swagger2markup.markupLanguage>
</config>

View File

@@ -16,6 +16,10 @@
package io.github.swagger2markup.internal.utils;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.swagger2markup.markup.builder.MarkupDocBuilder;
import io.github.swagger2markup.model.PathOperation;
import io.swagger.models.*;
@@ -27,6 +31,7 @@ import io.swagger.models.properties.RefProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -36,11 +41,11 @@ public class ExamplesUtil {
private static Logger logger = LoggerFactory.getLogger(ExamplesUtil.class);
/**
* Generates a Map of response examples
* Generates a map of response examples from the given {@code operation}
*
* @param generateMissingExamples specifies the missing examples should be generated
* @param operation the Swagger Operation
* @param definitions the map of definitions
* @param definitions the map of all available definitions
* @param markupDocBuilder the markup builder
* @return map containing response examples.
*/
@@ -75,13 +80,13 @@ public class ExamplesUtil {
}
/**
* Generates examples for request
* Generates a map of request examples from the given {@code operation}
*
* @param generateMissingExamples specifies the missing examples should be generated
* @param pathOperation the Swagger Operation
* @param definitions the map of definitions
* @param definitions the map of all available definitions
* @param markupDocBuilder the markup builder
* @return an Optional with the example content
* @return map containing request examples
*/
public static Map<String, Object> generateRequestExampleMap(boolean generateMissingExamples, PathOperation pathOperation, Map<String, Model> definitions, MarkupDocBuilder markupDocBuilder) {
Operation operation = pathOperation.getOperation();
@@ -174,6 +179,15 @@ public class ExamplesUtil {
Object example = null;
if (model != null) {
example = model.getExample();
// Workaround for https://github.com/swagger-api/swagger-parser/issues/255 returning a string
if (model instanceof ArrayModel && example instanceof String) {
ObjectMapper mapper = new ObjectMapper();
try {
example = mapper.readTree((String) example);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
if (example == null && generateMissingExamples) {
if (model instanceof ComposedModel) {
example = exampleMapForProperties(getPropertiesForComposedModel((ComposedModel) model, definitions), definitions, markupDocBuilder);
@@ -222,22 +236,24 @@ public class ExamplesUtil {
*/
public static Map<String, Object> exampleMapForProperties(Map<String, Property> properties, Map<String, Model> definitions, MarkupDocBuilder markupDocBuilder) {
Map<String, Object> exampleMap = new LinkedHashMap<>();
for (Map.Entry<String, Property> property : properties.entrySet()) {
Object exampleObject = property.getValue().getExample();
if (exampleObject == null) {
if (property.getValue() instanceof RefProperty) {
exampleObject = generateExampleForRefModel(true, ((RefProperty) property.getValue()).getSimpleRef(), definitions, markupDocBuilder);
} else if (property.getValue() instanceof ArrayProperty) {
exampleObject = generateExampleForArrayProperty((ArrayProperty) property.getValue(), definitions, markupDocBuilder);
} else if (property.getValue() instanceof MapProperty) {
exampleObject = generateExampleForMapProperty((MapProperty) property.getValue(), markupDocBuilder);
}
if (properties != null) {
for (Map.Entry<String, Property> property : properties.entrySet()) {
Object exampleObject = property.getValue().getExample();
if (exampleObject == null) {
Property valueProperty = property.getValue();
exampleObject = PropertyUtils.generateExample(valueProperty, markupDocBuilder);
if (property.getValue() instanceof RefProperty) {
exampleObject = generateExampleForRefModel(true, ((RefProperty) property.getValue()).getSimpleRef(), definitions, markupDocBuilder);
} else if (property.getValue() instanceof ArrayProperty) {
exampleObject = generateExampleForArrayProperty((ArrayProperty) property.getValue(), definitions, markupDocBuilder);
} else if (property.getValue() instanceof MapProperty) {
exampleObject = generateExampleForMapProperty((MapProperty) property.getValue(), markupDocBuilder);
}
if (exampleObject == null) {
Property valueProperty = property.getValue();
exampleObject = PropertyUtils.generateExample(valueProperty, markupDocBuilder);
}
}
exampleMap.put(property.getKey(), exampleObject);
}
exampleMap.put(property.getKey(), exampleObject);
}
return exampleMap;
}

View File

@@ -24,6 +24,7 @@ import io.swagger.models.refs.RefFormat;
import org.apache.commons.lang3.Validate;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public final class ModelUtils {
@@ -69,7 +70,7 @@ public final class ModelUtils {
return new BasicType(modelImpl.getType(), modelImpl.getTitle());
} else if (model instanceof ComposedModel) {
ComposedModel composedModel = (ComposedModel) model;
Map<String, Property> allProperties = new HashMap<>();
Map<String, Property> allProperties = new LinkedHashMap<>();
ObjectTypePolymorphism polymorphism = new ObjectTypePolymorphism(ObjectTypePolymorphism.Nature.NONE, null);
String name = model.getTitle();

View File

@@ -51,11 +51,17 @@ public final class PropertyUtils {
} else if (property instanceof ArrayProperty) {
ArrayProperty arrayProperty = (ArrayProperty) property;
Property items = arrayProperty.getItems();
type = new ArrayType(arrayProperty.getTitle(), getType(items, definitionDocumentResolver));
if (items == null)
type = new ArrayType(arrayProperty.getTitle(), new ObjectType(null, null)); // FIXME : Workaround for Swagger parser issue with composed models (https://github.com/Swagger2Markup/swagger2markup/issues/150)
else
type = new ArrayType(arrayProperty.getTitle(), getType(items, definitionDocumentResolver));
} else if (property instanceof MapProperty) {
MapProperty mapProperty = (MapProperty) property;
Property additionalProperties = mapProperty.getAdditionalProperties();
type = new MapType(mapProperty.getTitle(), getType(additionalProperties, definitionDocumentResolver));
if (additionalProperties == null)
type = new MapType(mapProperty.getTitle(), new ObjectType(null, null)); // FIXME : Workaround for Swagger parser issue with composed models (https://github.com/Swagger2Markup/swagger2markup/issues/150)
else
type = new MapType(mapProperty.getTitle(), getType(additionalProperties, definitionDocumentResolver));
} else if (property instanceof StringProperty) {
StringProperty stringProperty = (StringProperty) property;
List<String> enums = stringProperty.getEnum();

View File

@@ -20,6 +20,7 @@ import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,6 +81,25 @@ public class AsciidocConverterTest {
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocConversion.html");
}
@Test
public void testSwagger2AsciiDocConversionInstagram() throws IOException, URISyntaxException {
//Given
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_instagram.yaml").toURI());
Path outputDirectory = Paths.get("build/test/asciidoc/instagram");
FileUtils.deleteQuietly(outputDirectory.toFile());
//When
Swagger2MarkupConverter.from(file).build()
.toFolder(outputDirectory);
//Then
String[] files = outputDirectory.toFile().list();
assertThat(files).hasSize(4).containsAll(expectedFiles);
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/asciidoc/instagram").toURI());
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocConversionInstagram.html");
}
@Test
public void testSwagger2AsciiDocConversionWithInterDocumentCrossReferences() throws IOException, URISyntaxException {
//Given
@@ -155,7 +175,6 @@ public class AsciidocConverterTest {
//When
Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
.withoutInlineSchema()
.withGeneratedExamples()
.build();
@@ -171,6 +190,7 @@ public class AsciidocConverterTest {
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocConversionWithGeneratedExamples.html");
}
@Ignore("swagger-parser-1.0.21 ignore Location def because it's referenced from an external ref (ExternalLocation)")
@Test
public void testSwagger2AsciiDocWithInlineSchema() throws IOException, URISyntaxException {
//Given
@@ -193,6 +213,7 @@ public class AsciidocConverterTest {
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocWithInlineSchema.html");
}
@Ignore("swagger-parser-1.0.21 ignore Location def because it's referenced from an external ref (ExternalLocation)")
@Test
public void testSwagger2AsciiDocWithInlineSchemaAndFlatBody() throws IOException, URISyntaxException {
//Given
@@ -460,6 +481,30 @@ public class AsciidocConverterTest {
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocConversionWithPolymorphism.html");
}
@Test
public void testSwagger2AsciiDocConversionWithPolymorphismAsIsOrdering() throws IOException, URISyntaxException {
//Given
Path file = Paths.get(AsciidocConverterTest.class.getResource("/json/swagger_polymorphism.json").toURI());
Path outputDirectory = Paths.get("build/test/asciidoc/polymorphismAsIsOrdering");
FileUtils.deleteQuietly(outputDirectory.toFile());
//When
Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
.withPropertyOrdering(OrderBy.AS_IS)
.build();
Swagger2MarkupConverter.from(file)
.withConfig(config)
.build()
.toFolder(outputDirectory);
//Then
String[] files = outputDirectory.toFile().list();
assertThat(files).hasSize(4).containsAll(expectedFiles);
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/asciidoc/polymorphismAsIsOrdering").toURI());
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocConversionWithPolymorphismAsIsOrdering.html");
}
@Test
public void testSwagger2AsciiDocConversionWithResponseHeaders() throws IOException, URISyntaxException {
//Given

View File

@@ -37,6 +37,11 @@ _optional_||integer(int64)
|===
[[_objectarray]]
=== ObjectArray
_Type_ : < object > array
[[_order]]
=== Order

View File

@@ -2,6 +2,32 @@
[[_paths]]
== Paths
[[_objectarray_patch]]
=== PATCH /objectArray
==== Parameters
[options="header", cols=".^1,.^3,.^10,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Body*|*body* +
_required_||<<_objectarray,ObjectArray>>|
|===
==== Example HTTP request
===== Request body
[source,json]
----
[ {
"op" : "replace",
"path" : "/s",
"v" : "w"
} ]
----
[[_addpet]]
=== Add a new pet to the store
....

View File

@@ -22,7 +22,19 @@ _optional_|*Example* : `"Canines"`|string
|===
|Name|Description|Schema
|*subObject* +
_optional_|*Example* : `"object"`|object
_optional_|*Example* : `"object"`|<<_complexobject_subobject,subObject>>
|===
[[_complexobject_subobject]]
*subObject*
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*id* +
_optional_|*Example* : `88`|integer(int64)
|*value* +
_optional_|*Example* : `"a value !"`|string
|===
@@ -37,6 +49,11 @@ _optional_|*Example* : `0`|integer(int64)
|===
[[_objectarray]]
=== ObjectArray
_Type_ : < object > array
[[_order]]
=== Order

View File

@@ -2,6 +2,39 @@
[[_paths]]
== Paths
[[_objectarray_patch]]
=== PATCH /objectArray
==== Parameters
[options="header", cols=".^1,.^3,.^10,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Body*|*body* +
_required_||<<_objectarray,ObjectArray>>|
|===
==== Example HTTP request
===== Request path
[source,json]
----
"/objectArray"
----
===== Request body
[source,json]
----
[ {
"op" : "replace",
"path" : "/s",
"v" : "w"
} ]
----
[[_addpet]]
=== Add a new pet to the store
....

View File

@@ -0,0 +1,225 @@
[[_definitions]]
== Definitions
[[_comment]]
=== Comment
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*created_time* +
_optional_||string
|*from* +
_optional_||<<_miniprofile,MiniProfile>>
|*id* +
_optional_||string
|*text* +
_optional_||string
|===
[[_image]]
=== Image
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*height* +
_optional_||integer
|*url* +
_optional_||string
|*width* +
_optional_||integer
|===
[[_like]]
=== Like
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*first_name* +
_optional_||string
|*id* +
_optional_||string
|*last_name* +
_optional_||string
|*type* +
_optional_||string
|*user_name* +
_optional_||string
|===
[[_location]]
=== Location
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*id* +
_optional_||string
|*latitude* +
_optional_||number
|*longitude* +
_optional_||number
|*name* +
_optional_||string
|===
[[_media]]
=== Media
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*comments:* +
_optional_||<<_media_comments,comments:>>
|*created_time* +
_optional_|Epoc time (ms)|integer
|*filter* +
_optional_||string
|*id* +
_optional_||integer
|*images* +
_optional_||<<_media_images,images>>
|*likes* +
_optional_||<<_media_likes,likes>>
|*location* +
_optional_||<<_location,Location>>
|*tags* +
_optional_||< <<_tag,Tag>> > array
|*type* +
_optional_||string
|*user* +
_optional_||<<_miniprofile,MiniProfile>>
|*users_in_photo* +
_optional_||< <<_miniprofile,MiniProfile>> > array
|*videos* +
_optional_||<<_media_videos,videos>>
|===
[[_media_comments]]
*comments:*
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*count* +
_optional_||integer
|*data* +
_optional_||< <<_comment,Comment>> > array
|===
[[_media_images]]
*images*
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*low_resolution* +
_optional_||<<_image,Image>>
|*standard_resolution* +
_optional_||<<_image,Image>>
|*thumbnail* +
_optional_||<<_image,Image>>
|===
[[_media_likes]]
*likes*
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*count* +
_optional_||integer
|*data* +
_optional_||< <<_miniprofile,MiniProfile>> > array
|===
[[_media_videos]]
*videos*
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*low_resolution* +
_optional_||<<_image,Image>>
|*standard_resolution* +
_optional_||<<_image,Image>>
|===
[[_miniprofile]]
=== MiniProfile
A shorter version of User for likes array
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*full_name* +
_optional_||string
|*id* +
_optional_||integer
|*profile_picture* +
_optional_||string
|*user_name* +
_optional_||string
|===
[[_tag]]
=== Tag
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*media_count* +
_optional_||integer
|*name* +
_optional_||string
|===
[[_user]]
=== User
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*bio* +
_optional_||string
|*counts* +
_optional_||<<_user_counts,counts>>
|*full_name* +
_optional_||string
|*id* +
_optional_||integer
|*profile_picture* +
_optional_||string
|*username* +
_optional_||string
|*website* +
_optional_||string
|===
[[_user_counts]]
*counts*
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*follows* +
_optional_||integer
|*follwed_by* +
_optional_||integer
|*media* +
_optional_||integer
|===

View File

@@ -0,0 +1,186 @@
= Instagram API
[[_overview]]
== Overview
The first version of the Instagram API is an exciting step forward towards
making it easier for users to have open access to their data. We created it
so that you can surface the amazing content Instagram users share every
second, in fun and innovative ways.
Build something great!
Once you've
http://instagram.com/developer/register/[registered your client] it's easy
to start requesting data from Instagram.
All endpoints are only accessible via https and are located at
`api.instagram.com`. For instance: you can grab the most popular photos at
the moment by accessing the following URL with your client ID
(replace CLIENT-ID with your own):
----
https://api.instagram.com/v1/media/popular?client_id=CLIENT-ID
----
You're best off using an access_token for the authenticated user for each
endpoint, though many endpoints don't require it.
In some cases an access_token will give you more access to information, and
in all cases, it means that you are operating under a per-access_token limit
vs. the same limit for your single client_id.
== Limits
Be nice. If you're sending too many requests too quickly, we'll send back a
`503` error code (server unavailable).
You are limited to 5000 requests per hour per `access_token` or `client_id`
overall. Practically, this means you should (when possible) authenticate
users so that limits are well outside the reach of a given user.
== Deleting Objects
We do our best to have all our URLs be
http://en.wikipedia.org/wiki/Representational_state_transfer[RESTful].
Every endpoint (URL) may support one of four different http verbs. GET
requests fetch information about an object, POST requests create objects,
PUT requests update objects, and finally DELETE requests will delete
objects.
Since many old browsers don't support PUT or DELETE, we've made it easy to
fake PUTs and DELETEs. All you have to do is do a POST with _method=PUT or
_method=DELETE as a parameter and we will treat it as if you used PUT or
DELETE respectively.
== Structure
=== The Envelope
Every response is contained by an envelope. That is, each response has a
predictable set of keys with which you can expect to interact:
`json
{
&quot;meta&quot;: {
&quot;code&quot;: 200
},
&quot;data&quot;: {
...
},
&quot;pagination&quot;: {
&quot;next_url&quot;: &quot;...&quot;,
&quot;next_max_id&quot;: &quot;13872296&quot;
}
}
`
==== META
The meta key is used to communicate extra information about the response to
the developer. If all goes well, you'll only ever see a code key with value
200. However, sometimes things go wrong, and in that case you might see a
response like:
`json
{
&quot;meta&quot;: {
&quot;error_type&quot;: &quot;OAuthException&quot;,
&quot;code&quot;: 400,
&quot;error_message&quot;: &quot;...&quot;
}
}
`
==== DATA
The data key is the meat of the response. It may be a list or dictionary,
but either way this is where you'll find the data you requested.
==== PAGINATION
Sometimes you just can't get enough. For this reason, we've provided a
convenient way to access more data in any request for sequential data.
Simply call the url in the next_url parameter and we'll respond with the
next set of data.
`json
{
...
&quot;pagination&quot;: {
&quot;next_url&quot;: &quot;https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&amp;max_id=13872296&quot;,
&quot;next_max_id&quot;: &quot;13872296&quot;
}
}
`
On views where pagination is present, we also support the "count" parameter.
Simply set this to the number of items you'd like to receive. Note that the
default values should be fine for most applications - but if you decide to
increase this number there is a maximum value defined on each endpoint.
=== JSONP
If you're writing an AJAX application, and you'd like to wrap our response
with a callback, all you have to do is specify a callback parameter with
any API call:
`
https://api.instagram.com/v1/tags/coffee/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&amp;callback=callbackFunction
`
Would respond with:
`js
callbackFunction({
...
});
`
=== Version information
[%hardbreaks]
_Version_ : v1
=== License information
[%hardbreaks]
_Terms of service_ : http://instagram.com/about/legal/terms/api
=== URI scheme
[%hardbreaks]
_Host_ : api.instagram.com
_BasePath_ : /v1
_Schemes_ : HTTPS
=== Tags
* Users
* Relationships : Relationships are expressed using the following terms:
**outgoing_status**: Your relationship to the user. Can be "follows",
"requested", "none".
**incoming_status**: A user's relationship to you. Can be "followed_by",
"requested_by", "blocked_by_you", "none".
* Media : At this time, uploading via the API is not possible. We made a conscious
choice not to add this for the following reasons:
* Instagram is about your life on the go we hope to encourage photos
from within the app.
* We want to fight spam & low quality photos. Once we allow uploading
from other sources, it's harder to control what comes into the Instagram
ecosystem. All this being said, we're working on ways to ensure users
have a consistent and high-quality experience on our platform.
* Commnts
* Likes
* Tags
* Location
* Subscribtions
=== Consumes
* `application/json`
=== Produces
* `application/json`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
[[_securityscheme]]
== Security
[[_key]]
=== key
[%hardbreaks]
_Type_ : apiKey
_Name_ : access_token
_In_ : QUERY
[[_oauth]]
=== oauth
[%hardbreaks]
_Type_ : oauth2
_Flow_ : implicit
_Token URL_ : https://instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token
[options="header", cols=".^3,.^17"]
|===
|Name|Description
|basic|to read any and all data related to a user (e.g. following/followed-by
lists, photos, etc.) (granted by default)
|comments|to create or delete comments on a users behalf
|relationships|to follow and unfollow users on a users behalf
|likes|to like and unlike items on a users behalf
|===

View File

@@ -0,0 +1,116 @@
[[_definitions]]
== Definitions
[[_array]]
=== Array
An array
[%hardbreaks]
_Polymorphism_ : Inheritance
_Discriminator_ : collType
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*name* +
_optional_||string
|*collType* +
_required_|collection type discriminator|string
|===
[[_cat]]
=== Cat
A representation of a cat
[%hardbreaks]
_Polymorphism_ : Inheritance
_Discriminator_ : petType
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*name* +
_optional_|conflicting property with inheriting model (issue #44)|string
|*petType* +
_required_||string
|*huntingSkill* +
_required_|The measured skill for hunting +
*Default* : `"lazy"`|enum (clueless, lazy, adventurous, aggressive)
|===
[[_collection]]
=== Collection
Collection parent type without discriminator
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*name* +
_optional_||string
|===
[[_dog]]
=== Dog
A representation of a dog with an alternative discriminator
[%hardbreaks]
_Polymorphism_ : Inheritance
_Discriminator_ : dogType
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*name* +
_required_||string
|*petType* +
_required_||string
|*dogType* +
_required_||string
|*packSize* +
_required_|the size of the pack the dog is from +
*Default* : `0`|integer(int32)
|===
[[_map]]
=== Map
A map without discriminator
[%hardbreaks]
_Polymorphism_ : Composition
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*name* +
_optional_||string
|*collType* +
_required_|collection type discriminator|string
|===
[[_pet]]
=== Pet
Pet parent type with discriminator
[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*name* +
_required_||string
|*petType* +
_required_||string
|===

View File

@@ -0,0 +1,19 @@
= Title
[[_overview]]
== Overview
Description
=== Version information
[%hardbreaks]
_Version_ : Developer build
=== URI scheme
[%hardbreaks]
_Host_ : localhost:8080

View File

@@ -0,0 +1,65 @@
[[_paths]]
== Paths
[[_getcolls]]
=== Get collections
....
GET /collections
....
==== Description
Get collections
==== Responses
[options="header", cols=".^1,.^15,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|OK|<<_collection,Collection>>
|===
==== Consumes
* `application/json`
==== Produces
* `*/*`
[[_getpets]]
=== Get Pets
....
GET /pets
....
==== Description
Get pets
==== Responses
[options="header", cols=".^1,.^15,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|OK|<<_pet,Pet>>
|===
==== Consumes
* `application/json`
==== Produces
* `*/*`

View File

@@ -717,6 +717,20 @@
}
}
}
},
"/objectArray": {
"patch": {
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/ObjectArray"
}
}
]
}
}
},
"securityDefinitions": {
@@ -757,6 +771,19 @@
}
},
"definitions": {
"ObjectArray": {
"type": "array",
"items": {
"type": "object"
},
"example": [
{
"op": "replace",
"path": "/s",
"v": "w"
}
]
},
"Identified": {
"properties": {
"id": {

File diff suppressed because it is too large Load Diff