首页 \ 问答 \ Swagger UI目前是否支持模型?(Does Swagger UI currently support models?)

Swagger UI目前是否支持模型?(Does Swagger UI currently support models?)

Swagger Spec提供了描述模型的规定。

但是,现有的Swagger-UI项目似乎没有使用它或显示模型。 看看Petstore演示 ,我看到一个模型被提供 ,但看不到它显示。

我错过了什么吗? 还是只是不支持?


The Swagger Spec has provision for describing a model.

However, the existing Swagger-UI project doesn't seem to consume it or display the model. Looking at the Petstore Demo, I see that a model is served, but can't see it displayed.

Am I missing something? Or is it just not supported yet?


原文:https://stackoverflow.com/questions/11102058
更新时间:2023-02-01 14:02

最满意答案

它不必是完全相同的对象,它只需要看起来与外部观察者相同。 如果将所有数据从一个对象复制到另一个对象,它将完成相同的任务。

public SmartForm(string loadCode)
{
    _loadCode = loadCode;
    SmartForms smartForms = new SmartForms(_loadCode);
    this.IdCode = smartForms[0].IdCode;
    this.Title = smartForms[0].Title;
}

It doesn't have to be exactly the same object, it just has to appear to be the same to external observers. If you copy all the data from one object to another, it will accomplish the same thing.

public SmartForm(string loadCode)
{
    _loadCode = loadCode;
    SmartForms smartForms = new SmartForms(_loadCode);
    this.IdCode = smartForms[0].IdCode;
    this.Title = smartForms[0].Title;
}

相关问答

更多
  • 是的,您可以在构造函数中使用this ,但不能在字段初始值设定项中使用它。 所以这是无效的: class Foo { private int _bar = this.GetBar(); int GetBar() { return 42; } } 但这是允许的: class Foo { private int _bar; public Foo() { _bar = this.GetBar(); } ...
  • 没有必要使用他们花哨的新奇地图。 template BaseImplementation* makeAlgo (const std::string& algo, const byte* seed, size_t size) { return new Impl(algo, seed, size); } typedef BaseImplementation* makeAlgo_t (const std::str ...
  • 您的代码当前包含内存泄漏:必须使用delete清除使用new创建的任何对象。 createWithID方法最好不要使用new ,看起来像这样: static Object createWithID(int id) { Object obj; obj.id = id; return obj; } 这似乎需要对象的附加副本,但实际上, 返回值优化通常会使该副本被优化掉。 Your code currently contains a memory leak: any object c ...
  • 它不必是完全相同的对象,它只需要看起来与外部观察者相同。 如果将所有数据从一个对象复制到另一个对象,它将完成相同的任务。 public SmartForm(string loadCode) { _loadCode = loadCode; SmartForms smartForms = new SmartForms(_loadCode); this.IdCode = smartForms[0].IdCode; this.Title = smartForms[0].Title; ...
  • 这不是工厂模式。 一个工厂总是会有一些构造逻辑,至少有一个new 。 这就是工厂的想法:调用者不必担心如何创建对象。 这是一个单身存储库。 所以首先,不要使用数组,而应该有一个类型索引字典。 private static Dictionary _singletons = new Dictionary(); 之后,你不需要一个注册方法。 当你检索单身人士时,字典应该被自动填充。 现在我想你的Feed类有一个没有参数的默认构造函数。 在这种情况下,您可以直接从抽 ...
  • 回应似乎没有......你只是梦想着。 来自https://stackoverflow.com/a/14343648/613130 : 问:创建构造函数(?)以从缓存中检索对象,如果为null则重新创建 答:您无法创建执行此操作的构造函数。 构造函数始终创建一个新对象。 而是,创建一个静态工厂方法: 请注意,肯定可以使用Fody (一种能够修改汇编后编译的工具)来创建一个插件,将直接的new Foo()替换为FooProxy.Create() The response seems to be no.... ...
  • 这是一个比我之前的评论更简单的方案。 只需在私有(但共享)范围内定义GNode类,这样就可以调用构造函数的唯一位置,并重置.constructor属性,使其不会泄漏: const GTree = (function() { class GNode { constructor() { } someOtherMethod() { console.log("someOtherMethod"); } ...
  • 我想你在第二部分描述工厂模式。 第一部分不是因为它依赖于调用者知道如何构建所需的对象。 在您的示例中, DateScheduleBuilderFactory将能够知道如何解释request对象中的信息并返回从DateScheduleBuilder派生的对象。 简而言之,就像上面的Johm Dom所说的那样。 你已经在那里...... I think you are describing the factory pattern in the second part. The first part is not ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。