Skip to content

Problema com TJSONBool no XE7 #18

@chacalfloripa

Description

@chacalfloripa

Olá Jaloto, ao tentar usar o SwagDoc no XE7 a classe TJSONBool não foi localizado pois só foi implementada no Delphi Seattle. A baixo vou listar os locais e as modificação que fiz.

Swag.Doc.Path.Operation.pas

Linha 259
if fDeprecated then
{$IF Defined(SeattleOrBetter)}
vJsonObject.AddPair(c_SwagPathOperationDeprecated, TJSONBool.Create(fDeprecated));
{$ELSE}
vJsonObject.AddPair(c_SwagPathOperationDeprecated, TJSONString.Create(BoolToStr(fDeprecated)));
{$ENDIF}

Swag.Doc.Path.Operation.RequestParameter.pas

Linha 197
if fRequired or (fInLocation = rpiPath) then
vJsonObject.AddPair(c_SwagRequestParameterRequired, TJSONTrue.Create);

if fAllowEmptyValue and (fInLocation = rpiQuery) or (fInLocation = rpiFormData) then
vJsonObject.AddPair(c_SwagRequestParameterAllowEmptyValue, TJSONTrue.Create);

Linha 243
if Assigned(pJson.Values[c_SwagRequestParameterAllowEmptyValue]) and
((fInLocation = rpiQuery) or (fInLocation = rpiFormData)) then
{$IF Defined(SeattleOrBetter)}
fAllowEmptyValue := (pJson.Values[c_SwagRequestParameterAllowEmptyValue] as TJSONBool).AsBoolean;
{$ELSE}
fAllowEmptyValue := StrToBoolDef((pJson.Values[c_SwagRequestParameterAllowEmptyValue] as TJSONString).ToString, True);
{$ENDIF}

if Assigned(pJson.Values[c_SwagRequestParameterRequired]) then
begin
{$IF Defined(SeattleOrBetter)}
fRequired := (pJson.Values[c_SwagRequestParameterRequired] as TJSONBool).AsBoolean
{$ELSE}
fRequired := StrToBoolDef((pJson.Values[c_SwagRequestParameterRequired] as TJSONString).ToString, True);
{$ENDIF}
end

Swag.Doc.Path.pas
Linha 171
if Assigned(vOperationJson.Values['deprecated']) then
{$IF Defined(SeattleOrBetter)}
vOperation.Deprecated := (vOperationJson.Values['deprecated'] as TJSONBool).AsBoolean;
{$ELSE}
vOperation.Deprecated := StrToBoolDef((vOperationJson.Values['deprecated'] as TJSONString).ToString, True);
{$ENDIF}

Abs,
Ismael Faustino

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions