gluu
静的公開メンバ関数 | 静的非公開メンバ関数 | 全メンバ一覧
org.xdi.oxd.server.swagger.ManualSwaggerGenerator クラス
org.xdi.oxd.server.swagger.ManualSwaggerGenerator 連携図
Collaboration graph

静的公開メンバ関数

static void main (String[] args) throws Exception
 

静的非公開メンバ関数

static void append (StringBuilder result, int indent, String toAppend)
 
static void handleJSONObject (StringBuilder result, JSONObject json, int indent)
 
static void appendProperties (StringBuilder result, JSONObject json, int indent)
 
static void appendRequired (StringBuilder result, JSONObject json, int indent)
 

詳解

著者
yuriyz

関数詳解

◆ append()

static void org.xdi.oxd.server.swagger.ManualSwaggerGenerator.append ( StringBuilder  result,
int  indent,
String  toAppend 
)
inlinestaticprivate
27  {
28  for (int i = 0; i < indent; i++) {
29  result.append(" ");
30  }
31  result.append(toAppend);
32  }

◆ appendProperties()

static void org.xdi.oxd.server.swagger.ManualSwaggerGenerator.appendProperties ( StringBuilder  result,
JSONObject  json,
int  indent 
)
inlinestaticprivate
41  {
42  append(result, indent, "properties:\n");
43  indent += 2;
44  Iterator keys = json.keys();
45  while (keys.hasNext()) {
46  String nextKey = (String) keys.next();
47  append(result, indent, String.format("%s:\n", nextKey)); // property name
48  Object opt = json.opt(nextKey);
49  if (opt instanceof String) {
50  append(result, indent, " type: string\n");
51  } else if (opt instanceof JSONObject) {
52  indent = indent + 2;
53  handleJSONObject(result, (JSONObject) opt, indent);
54  } else if (opt instanceof Integer || opt instanceof Long) {
55  append(result, indent, " type: integer\n");
56  } else if (opt instanceof Boolean) {
57  append(result, indent, " type: boolean\n");
58  } else if (opt instanceof Float || opt instanceof Double) {
59  append(result, indent, " type: number\n");
60  } else if (opt instanceof JSONArray) {
61  append(result, indent, " type: array\n");
62  append(result, indent, " items:\n");
63  append(result, indent, " type: string\n");
64  } else if (opt == null || opt == JSONObject.NULL) {
65  append(result, indent, " type: string\n");
66  } else {
67  System.out.println(opt);
68  }
69 
70  switch (nextKey) {
71  case "status":
72  append(result, indent, " example: ok\n");
73  break;
74  case "oxd_id":
75  append(result, indent, " example: bcad760f-91ba-46e1-a020-05e4281d91b6\n");
76  break;
77  case "client_id_of_oxd_id":
78  append(result, indent, " example: ccad760f-91ba-46e1-a020-05e4281d91b6\n");
79  break;
80  case "op_host":
81  append(result, indent, " example: https://<op-hostname>\n");
82  break;
83  case "client_id":
84  append(result, indent, " example: '@!1736.179E.AA60.16B2!0001!8F7C.B9AB!0008!A2BB.9AE6.5F14.B387'\n");
85  break;
86  case "client_secret":
87  append(result, indent, " example: f436b936-03fc-433f-9772-53c2bc9e1c74\n");
88  break;
89  case "client_registration_access_token":
90  append(result, indent, " example: d836df94-44b0-445a-848a-d43189839b17\n");
91  break;
92  case "client_registration_client_uri":
93  append(result, indent, " example: https://<op-hostname>/oxauth/restv1/register?client_id=@!1736.179E.AA60.16B2!0001!8F7C.B9AB!0008!A2BB.9AE6.5F14.B387\n");
94  break;
95  case "client_id_issued_at":
96  append(result, indent, " example: 1501854943\n");
97  break;
98  case "client_secret_expires_at":
99  append(result, indent, " example: 1501941343\n");
100  break;
101  case "scope":
102  append(result, indent, " example: [\"openid\"]\n");
103  break;
104  case "authorization_redirect_uri":
105  case "post_logout_redirect_uri":
106  append(result, indent, " example: https://client.example.org/cb\n");
107  break;
108  case "application_type":
109  append(result, indent, " example: web\n");
110  break;
111  case "response_types":
112  append(result, indent, " example: [\"code\"]\n");
113  break;
114  case "grant_types":
115  append(result, indent, " example: [\"authorization_code\", \"client_credentials\"]\n");
116  break;
117  case "acr_values":
118  append(result, indent, " example: [\"basic\"]\n");
119  break;
120  case "contacts":
121  append(result, indent, " example: [\"foo_bar@spam.org\"]\n");
122  break;
123  case "access_token":
124  append(result, indent, " example: b75434ff-f465-4b70-92e4-b7ba6b6c58f2\n");
125  break;
126  case "expires_in":
127  case "exp":
128  append(result, indent, " example: 299\n");
129  break;
130  case "iat":
131  append(result, indent, " example: 1419350238\n");
132  break;
133  case "aud":
134  append(result, indent, " example: l238j323ds-23ij4\n");
135  break;
136  case "active":
137  append(result, indent, " example: true\n");
138  break;
139  case "username":
140  append(result, indent, " example: John Black\n");
141  break;
142  case "token_type":
143  append(result, indent, " example: bearer\n");
144  break;
145  case "sub":
146  append(result, indent, " example: jblack\n");
147  break;
148  case "iss":
149  append(result, indent, " example: https://as.gluu.org/\n");
150  break;
151  case "extension_field":
152  append(result, indent, " example: twenty-seven\n");
153  break;
154  case "id_token":
155  append(result, indent, " example: eyJraWQiOiI5MTUyNTU1Ni04YmIwLTQ2MzYtYTFhYy05ZGVlNjlhMDBmYWUiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NlLWRldjMuZ2x1dS5vcmciLCJhdWQiOiJAITE3MzYuMTc5RS5BQTYwLjE2QjIhMDAwMSE4RjdDLkI5QUIhMDAwOCE5Njk5LkFFQzcuOTM3MS4yODA3IiwiZXhwIjoxNTAxODYwMzMwLCJpYXQiOjE1MDE4NTY3MzAsIm5vbmNlIjoiOGFkbzJyMGMzYzdyZG03OHU1OTUzbTc5MXAiLCJhdXRoX3RpbWUiOjE1MDE4NTY2NzIsImF0X2hhc2giOiItQ3gyZHo1V3Z3X2tCWEFjVHMzbUZBIiwib3hPcGVuSURDb25uZWN0VmVyc2lvbiI6Im\n");
156  break;
157  case "refresh_token":
158  append(result, indent, " example: 33d7988e-6ffb-4fe5-8c2a-0e158691d446\n");
159  break;
160  case "at_hash":
161  append(result, indent, " example: -Cx2dz5Wvw_kBXAcTs3mFA\n");
162  break;
163  }
164  }
165  }
static void append(StringBuilder result, int indent, String toAppend)
Definition: ManualSwaggerGenerator.java:27
static void handleJSONObject(StringBuilder result, JSONObject json, int indent)
Definition: ManualSwaggerGenerator.java:34

◆ appendRequired()

static void org.xdi.oxd.server.swagger.ManualSwaggerGenerator.appendRequired ( StringBuilder  result,
JSONObject  json,
int  indent 
)
inlinestaticprivate
167  {
168  append(result, indent, "required:\n");
169  Iterator keys = json.keys();
170  while (keys.hasNext()) {
171  String nextKey = (String) keys.next();
172  append(result, indent, String.format(" - %s\n", nextKey));
173  }
174  }
static void append(StringBuilder result, int indent, String toAppend)
Definition: ManualSwaggerGenerator.java:27

◆ handleJSONObject()

static void org.xdi.oxd.server.swagger.ManualSwaggerGenerator.handleJSONObject ( StringBuilder  result,
JSONObject  json,
int  indent 
)
inlinestaticprivate
34  {
35  append(result, indent, "type: object\n");
36 
37  appendRequired(result, json, indent);
38  appendProperties(result, json, indent);
39  }
static void append(StringBuilder result, int indent, String toAppend)
Definition: ManualSwaggerGenerator.java:27
static void appendRequired(StringBuilder result, JSONObject json, int indent)
Definition: ManualSwaggerGenerator.java:167
static void appendProperties(StringBuilder result, JSONObject json, int indent)
Definition: ManualSwaggerGenerator.java:41

◆ main()

static void org.xdi.oxd.server.swagger.ManualSwaggerGenerator.main ( String []  args) throws Exception
inlinestatic
15  {
16  InputStream inputStream = ManualSwaggerGenerator.class.getResourceAsStream("/input.json");
17  try {
18  StringBuilder result = new StringBuilder();
19  JSONObject json = new JSONObject(IOUtils.toString(inputStream));
20  handleJSONObject(result, json, 12);
21  System.out.println(result);
22  } finally {
23  IOUtils.closeQuietly(inputStream);
24  }
25  }
static void handleJSONObject(StringBuilder result, JSONObject json, int indent)
Definition: ManualSwaggerGenerator.java:34

このクラス詳解は次のファイルから抽出されました: