我正在为我的学校LAN网络设计一个聊天,它将你的消息键入一个.dll文件,以便伪装聊天记录.
问题是突然间,每当我开始输入有空格的消息时,批处理文件就会崩溃.例如,如果我输入消息为"h h",批处理将崩溃并显示错误:
h ==退出此时意外
继承人脚本:
@echo off
CLS
COLOR f2
SET user=%username%
SET message=
IF %user%==Josh SET cuser=Miltzi & GOTO :admin
IF %user%==miltzj SET cuser=Miltzi & GOTO :admin
IF %user%==steinj SET cuser=Jarod & GOTO :first
IF %user%==steinda SET cuser=Daniel & GOTO :first
IF %user%==rubine SET cuser=Evan & GOTO :first
IF %user%==sklairn SET cuser=Nathan & GOTO :first
IF %user%==portnoyc SET cuser=Craig & GOTO :first
IF %user%==polakowa SET cuser=Polly & GOTO :first
IF %user%==selbya SET cuser=Alex & GOTO :first
IF %user%==vanderwesthuizenl …Run Code Online (Sandbox Code Playgroud) 我想从C#应用程序管理远程计算机上的共享文件夹.有没有办法用C#做到这一点?
我知道WMI可以进行远程管理,但我还没有找到管理文件和文件夹共享的方法.
我在使用OpenAPI 3定义可重用的模式组件时遇到了麻烦,因为OpenAPI 3允许包含多种类型的数组.每个项类型都继承自同一父类,但具有特定的子属性.这似乎model在SwaggerHub 的视图中正常工作,但示例视图未正确显示数据.
TLDR; 有没有办法在OpenAPI 3中定义包含不同对象类型的数组?
Response:
allOf:
- $ref: '#/components/schemas/BaseResponse'
- type: object
title: A full response
required:
- things
properties:
things:
type: array
items:
anyOf:
- $ref: '#/components/schemas/ItemOne'
- $ref: '#/components/schemas/ItemTwo'
- $ref: '#/components/schemas/ItemThree'
Run Code Online (Sandbox Code Playgroud) 我试图在此示例中为“房屋”添加一个只读字段。这房子是我想成为只读的另一种模型。
在此示例中,可以将Dogs数组设置为readOnly没有错误,但是当我将House的单一定义设置readOnly为时,在Swagger编辑器中会收到以下警告:
$ refs不允许同级值
我知道这是因为模型中的所有内容都在这里继承。那么,如何定义写API调用不能在此端点中定义“房屋”,同时又允许在另一个API端点中创建和更新房屋?
Pets:
properties:
id:
type: string
example: AAAAE12-1123AEF-1122312123
readOnly: true
name:
type: string
example: My Default Name
text:
type: string
example: My Default Text
Dogs:
type: array
readOnly: true
items:
$ref: '#/definitions/Dog'
House:
readOnly: true
$ref: '#/definitions/House'
Run Code Online (Sandbox Code Playgroud) 我有以下 OpenAPI 定义:
swagger: "2.0"
info:
version: 1.0.0
title: Simple API
description: A simple API to learn how to write OpenAPI Specification
schemes:
- https
host: now.httpbin.org
paths:
/:
get:
summary: Get date in rfc2822 format
responses:
200:
schema:
type: object
items:
properties:
now:
type: object
rfc2822:
type: string
Run Code Online (Sandbox Code Playgroud)
我想rfc2822从响应中检索:
{"now": {"epoch": 1531932335.0632613, "slang_date": "today", "slang_time": "now", "iso8601": "2018-07-18T16:45:35.063261Z", "rfc2822": "Wed, 18 Jul 2018 16:45:35 GMT", "rfc3339": "2018-07-18T16:45:35.06Z"}, "urls": ["/", "/docs", "/when/:human-timestamp", "/parse/:machine-timestamp"]}
Run Code Online (Sandbox Code Playgroud)
但是当我从 Swagger Editor …
我正在使用 OpenAPI 3 并有两个查询参数,其中至少一个是必需的,但哪个无关紧要。
即,作为sudocode:
if parameter_1 OR parameter_2:
do stuff
else:
error
Run Code Online (Sandbox Code Playgroud)
这在 OpenAPI 3 中可能吗?就我所见,规范或 JSON Schema 规范中都没有提及它。
我使用https://generator.swagger.io/ 上的在线 Swagger Codegen为这个 API生成了一个 Python 客户端库。API 使用 Bearer 身份验证:
openapi: 3.0.0
...
paths:
/sandbox/register:
post:
...
security:
- sso_auth: []
...
components:
securitySchemes:
sso_auth:
type: http
scheme: bearer
Run Code Online (Sandbox Code Playgroud)
但是,Configuration生成的 Python 客户端中的类没有access_token字段。
使用生成的客户端库时如何填写不记名访问令牌?
代码生成端点POST /gen/clients/{language}具有authorizationValue和securityDefinition参数 - 我是否需要以某种方式配置这些参数?
"authorizationValue": {
"value": "string",
"type": "string",
"keyName": "string"
},
"securityDefinition": {
"type": "string",
"description": "string"
}
Run Code Online (Sandbox Code Playgroud) 将 OpenAPI 上传到 Azure API 管理时,API 的默认 swagger 生成会出现错误。使用Swagger Editor进行测试,出现以下错误:
“$ref 值必须是符合 RFC3986 的百分比编码 URI”。
看来我的嵌套类数据类型已转换为:
$ref: >-
#/components/schemas/Namespace.Class+NestedClass
Run Code Online (Sandbox Code Playgroud)
我猜这是需要删除或编码的“+”符号。关于如何实现这一目标有什么建议吗?
我有一个枚举:
public enum UserType {
ADMIN("Admin"),
GUEST("Guest"),
SUPERVIOR("Supervisor"),
NORMAL("Normal");
private final String type;
UserType(final String type) {
this.type = type;
}
Run Code Online (Sandbox Code Playgroud)
我将它用作带有 Swagger 注释的查询参数:
@GET
@AsyncTimed
@Path("/all")
void all(
@ApiParam @PathParam(USER_ID) @Parameter(in = ParameterIn.PATH, name = USER_ID, required = true) final UserId userId,
@QueryParam(TYPES) final Set<UserType> userTypes,
@Suspended final AsyncResponse asyncResponse
);
Run Code Online (Sandbox Code Playgroud)
然而,生成的 OpenAPI 文件并没有从枚举中创建组件,而是给出:
get:
parameters:
- name: UserId
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
- name: Types
in: query
schema:
uniqueItems: true
type: array
items:
type: string …Run Code Online (Sandbox Code Playgroud) 我意识到关于为什么 Java 或其他语言不支持无符号整数有很多类似的问题,但这些都是关于语言设计背后的基本原理和哲学的问题,旨在表达新事物的创造力。
OpenAPI 应该是描述性的。如果 API 想要公开 64 位无符号字,它应该能够做到。OpenAPI 应该有助于代码生成器构建客户端来使用该 API。
好吧,这个论点可以无限地进行,以允许各种奇异的原始类型。这可以被指出为“他们必须在某处划清界限”。
但无符号 32 位和 64 位字是非常常见的原语。为什么他们不受支持?
额外奖励:哪些 REST API 规范格式支持它们?
openapi ×7
swagger ×5
c# ×2
swagger-ui ×2
batch-file ×1
bearer-token ×1
chat ×1
cors ×1
enums ×1
java ×1
jsonschema ×1
python ×1
rest ×1
swagger-2.0 ×1
windows ×1
wmi ×1